What are your most useful custom ASP.NET MVC 2.0 Validation Attributes
What are the custom ASP.NET MVC model validation attributes that you use. It seems that there are a ton of possibilities (zip code, email address, date in the past, etc.) but开发者_如何学Go I haven't found any good sources where these are shared. I'll start the list with the following:
ASP.NET MVC 3 Credit Card Validator
If you use the MVC Foolproof project on codeplex you will get a bunch of ready-to-use validators like
Operator Validators
[Is]
[EqualTo]
[NotEqualTo]
[GreaterThan]
[LessThan]
[GreaterThanOrEqualTo]
[LessThanOrEqualTo]
Required Validators
[RequiredIf]
[RequiredIfNot]
[RequiredIfTrue]
[RequiredIfFalse]
[RequiredIfEmpty]
[RequiredIfNotEmpty]
[RequiredIfRegExMatch]
[RequiredIfNotRegExMatch]
精彩评论