You can use ASP. NET rangevalidator Controls whether user input is within a specific value range, for example, between two numbers, two dates, or letter characters. You can set the upper and lower limits of the value range Rangevalidator Controls. You must also specify the Data Type of the value to be verified by the control. If the user input cannot be converted to the specified data type, for example, cannot be converted to a date, verification will fail.
1, SetRangevalidatorAdd the control to the page and set the following attributes:
| attribute |
description |
| controltovalidate |
id . |
| errormessage , text , display |
Some attributes are used to specify the text content and position of errors displayed when the user skips the control. |
2 , use minimumvalue and maximumvalue attribute Set the upper and lower limits of the range.
3 , set type attribute specifies the data type set by the range. Use validationdatatype enumeration to specify the following types:
String , Integer , Double , Date , Currency
Note: If you leave the control blank, the control passes range verification. To force the user to enter a value, addRequiredfieldvalidatorControl.
4InASP. NETWebpageCodeTo check validity.