Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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

like image 421
JP. Avatar asked Nov 06 '10 01:11

JP.


1 Answers

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]
like image 112
Lorenzo Avatar answered Sep 27 '22 22:09

Lorenzo