views:

102

answers:

1

Asp.net mvc2: How to add validation rules - A number field is not required but has range limitation?

A: 

Use the Range Attribute from DataAnnotations.

[Range(0, 255, ErrorMessage="The number must be between 0 and 255.")]
Marc Tidd