开发者

Validation Attribute - checking a dynamic number of fields on a form ASP.NET MVC 2

开发者 https://www.devze.com 2023-01-11 04:32 出处:网络
I have a number of forms with checkboxes that need validating. For example I might have a form with 3 checkboxes and one of those 3 n开发者_JAVA技巧eeds ticking and another form with 50 boxes that mig

I have a number of forms with checkboxes that need validating. For example I might have a form with 3 checkboxes and one of those 3 n开发者_JAVA技巧eeds ticking and another form with 50 boxes that might need at least one item checking.

Does anyone have a ValidationAttribute that would work under these circumstances.

Many thanks for any pointers.


You can do that with class-level validation attributes (as opposed to property-level attributes). I've written a blog article describing how to implement this on both the server and the client side if you want to make this really ajaxy... :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号