简体   繁体   English

设计动态数据录入表单的建议

[英]Suggestion for Design a Dynamic Data Entry Form

I want to create a dynamic data entry form based on this circumstance:我想根据这种情况创建一个动态数据输入表单:

user can create a form and add to this form any number of fields with different accepting data types(such a field for text and another for currency and...).this fileds also can custom validation on them.用户可以创建一个表单并向该表单添加具有不同接受数据类型的任意数量的字段(例如文本字段和货币字段和...)。此字段还可以对其进行自定义验证。

what is your efficiet idea about designing my tables in database any best way to implement this in c#.在 c# 中设计我的数据库表的最佳方法是什么?

(I don't want whole code please just say your ideas and if code needs please write psudo code) (我不想要整个代码,请说出您的想法,如果需要代码,请编写伪代码)

thanks my friend朋友,谢谢

My idea is to create a base form that handles CRUD operation,and create some custom controls that have special property,like fieldname,fieldlength,caption,... showing a table in tree view that user can drag and drop field from treeview to design sheet can be good idea, in save or delete or update operation you can read all related fields in form,and affect proper operation on database我的想法是创建一个处理 CRUD 操作的基本表单,并创建一些具有特殊属性的自定义控件,如字段名、字段长度、标题、...在树视图中显示一个表格,用户可以从 treeview 拖放字段来设计sheet 可能是个好主意,在保存或删除或更新操作中,您可以读取表单中的所有相关字段,并影响对数据库的正确操作

If you're using ASP.NET for the front end:如果您使用 ASP.NET 作为前端:

First, you build custom controls for each data type in your dynamic data entry form.首先,您为动态数据输入表单中的每种数据类型构建自定义控件。 These custom controls need to encapsulate pre-defined validations (ie, required field validation, regex validation, data type validation, etc.) and even support custom validation if you want to cover lots of data validation scenarios.这些自定义控件需要封装预定义的验证(即必填字段验证、正则表达式验证、数据类型验证等),如果您想覆盖大量数据验证场景,甚至支持自定义验证。

Then, you defined the meta data that drives the dynamic data entry form in typically database or xml.然后,您在典型的数据库或 xml 中定义了驱动动态数据输入表单的元数据。 The meta data should define the data type of each field and what validations each field needs to have.元数据应定义每个字段的数据类型以及每个字段需要进行的验证。

Finally, you build the data entry form dynamicly using the meta data and the corresponding controls.最后,您使用元数据和相应的控件动态构建数据输入表单。 For ASP.NET, this is usually done at the Init stage of the page.对于 ASP.NET,这通常在页面的 Init 阶段完成。

For the design, there's good articles here: Creating Dynamic Data Entry User Interfaces .对于设计,这里有很好的文章:创建动态数据输入用户界面

For the custom controls, please take a look of XField Suite .对于自定义控件,请查看XField Suite These are controls I wrote to make building rich dynamic data entry form easy for developers.这些是我编写的控件,以使开发人员可以轻松构建丰富的动态数据输入表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM