The RangeValidator control ensures that the field's value is within range.


Type your age in below textfield in numeric value, if your age is less than 18 years or more than 40 years then an ErrorMessage displays "Your age must be between 18 to 40 Years".

View Source Code