ASP.NET MVC 2 and ComponentModel.DataAnnotations Validation: minimum value attribute


ASP.NET MVC 2 and ComponentModel.DataAnnotations Validation: minimum value attribute



I'm decorated a ViewModel in my ASP.NET MVC 2 site with System.ComponentModel.DataAnnotations validation attributes. For one of my fields, named Price, I want to validate that the value is not below some extent, in this case 0.

I know that RangeAttribute exists for validation with a lower and an upper extent, but does something like a MinimumValueAttribute exist for validation with only a lower extent?

If not, I guess I'll just roll my own.


How do I keep field values in the ASP.NET MVC form if it has been invalidated?

1:

Fill textboxes based upon current Dropdownlist (database items) selection (asp.NET MVC)
before you roll your own - try [Range(0.05, Double.MaxValue)]. Why does this code changes location as I need it to
MVC .NET 4.0 : Image LinksAre there any action filters in your project you feel are a must-have?

2:

New suggestions for error handling in ASP.NET MVC 2
Not sure if RegularExpression is the "best" solution, although you must commit it a shot. ASP.NET WebForms with MVC localization issue
"^\$?\d+(\.(\d{2}))?$" 
Is it possible to map complex types with SolrNet

63 out of 100 based on 58 user ratings 773 reviews

*