Asp.net mvc2: How to add validation rules - A number field is not required but has range limitation?
Asp.net mvc2: How to 开发者_如何学JAVAadd validation rules - A number field is not required but has range limitation?
Use the Range Attribute from DataAnnotations.
[Range(0, 255, ErrorMessage="The number must be between 0 and 255.")]
精彩评论