The RangeValidator control is used to check if the value of a control lies within a range.
Example: |
|
|
Suppose that you want your user must be in between 18 to 60 years, then you can use RangeValidator to validate user's age during the registration by setting the following RangeValidator's properties: |
ID |
Age_Validator |
ControlToValidate |
Age |
ErrorMessage |
Your age must be in the range of 18-60 years |
Maximum |
60 |
Minimum |
18 |
MinimumValue and MaximimValue are used to set the lower and the upper limit of the range respectively.
Code Snippet:
<asp:rangevalidator controltovalidate="Age" errormessage="Your age must be in the range of 18-60 years" id="Age_Validator" maximumvalue="60" minimumvalue="18" runat="server"></asp:rangevalidator> |
No comments:
Post a Comment