1

I am using datannotations and the server/client side validation stuff in ASP.NET MVC 2. Everything works fine if a class has properties such as:

[Required(ErrorMessage = "whatever")]
String blah;

but I have no idea how to make this:

[Range(13134, 42352345, ErrorMessage = "outside of range")]
List<int> blah;

where I want the int to be in that range.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
BobTurbo
  • 289
  • 4
  • 14
  • http://stackoverflow.com/questions/tagged/asp.net-mvc-validation There are several examples at this tag. http://stackoverflow.com/questions/2383669/how-to-create-custom-validation-attribute-for-mvc like this one. – ba__friend May 26 '11 at 10:42

1 Answers1

0

I think you will have to write a custom validator to do this. This article by Scott Gu is useful for explaining writing custom validators

This msdn article may be more appropriate as it specifically discusses custom range validation

IndigoDelta
  • 1,481
  • 9
  • 11