[英]Conditional RequiredFieldAttribute
I am developing a Silverlight application and I have a form in which some data fields are shown depending on business rules. 我正在开发Silverlight应用程序,并且有一个表格,其中根据业务规则显示了一些数据字段。 All the fields are required but some fields don't show up all the time.
所有字段都是必填字段,但有些字段不会一直显示。
So, I have a problem with the RequiredFieldAttribute
because I can't pass parameters to it such as the condition. 因此,我在
RequiredFieldAttribute
遇到了问题,因为我无法将诸如条件之类的参数传递给它。 When I try to save the current data form it would complain about the fields that are not in the form that they are required. 当我尝试保存当前数据表单时,它会抱怨字段不是必填字段。
Is there a way around this? 有没有解决的办法? Thanks.
谢谢。
我最终使用了自定义验证器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.