与动态表单的ASP.NET MVC咨询 [英] Advice with Dynamic Forms in ASP.NET MVC

查看:139
本文介绍了与动态表单的ASP.NET MVC咨询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作呈现一个动态的形式在一个ASP.NET MVC视图,将符合下列要求:

I am working on rendering a dynamic form in an ASP.NET MVC view that will meet these requirements:

  • 字段可以验证
  • 国家是preserved当表单无效

我期待到创建自定义模型绑定来实现这一目标。一般我打算做到这一点:

I am looking into creating a custom model binder to achieve this. I am generally planning to do this:

  1. 在表单域与这些属性进行定义
    • 提示符(标签旁边场)
    • 类型(文本,的CheckBoxList,单选列表,等等。)
    • 选择(单场)
    • IsRequired
    • RegularEx pression(对于文本字段)
    • 在显示选项
  1. Form fields are defined with these properties
    • Prompt (label next to fields)
    • Type (text, checkboxlist, radiolist, etc.)
    • Choices (for list fields)
    • IsRequired
    • RegularExpression (for text fields)
    • Display Options
  • 如果需要 - >必须有一个值
  • 如果正则表达式 - >必须匹配
  • 对于每个字段无效,被添加一个错误消息到ModelState中
  • 如果所有的字段都有效
    • 在做任何的字段及其值
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆