Reputation: 2971
DataAnnotations: Range, required... got it.
But just checking value==5 or value==bool?
Upvotes: 1
Views: 281
Reputation: 25704
Also, if you want to see a sample of how to implement a custom ValidationAttribute, there's are a couple of them in ASP.NET MVC 2.
If you install ASP.NET MVC 2 RC the new default project has two sample attributes that you can look at in ~/Models/AccountModels.cs.
Upvotes: 1
Reputation: 68667
There isn't one included in .NET, although you can create your own by implementing the ValidationAttribute abstract class. All you have to do is override the IsValid method.
Upvotes: 2