Range validation not working properly in MVC3
- by Colin Desmond
I am generating data validation javascript in an Asp.Net MVC 3 application with the following code
[DisplayName("Latitude Degrees")]
[Range(0, 90, ErrorMessage = "Latitude degrees must be between {1} and {2}")]
public Int32? LatitudeDegrees { get; set; }
on a view model. When it was MVC2 this worked just fine, if I entered a value outside of 0-90 in the textbox I got the validation warnings.
Since I moved the application to MVC 3, whenever I put any value into the texbox, legal or illegal I get the validation error appear next to it.
I have EnableClientValidation set to true and UseUnobtrusiveJavascript is off (nothing in web.config or the views to turn it on).