The RangeValidator control checks that the entered value is within a certain range. It has three special properties: MinimumValue, MaximumValue, and Type.
The MinimumValue and MaximumValue properties define the range of valid values and the Type property defines the type of data that will be entered in the input control and checked for validity. The supported values are Currency, Date, Double, Integer and String.
The following example will test if the date entered is between January 1 and December 31, 2012 (here the dates are encoded in a locale-independent format “dd/MM/yyyy”; if the web server uses other regional settings, change the date format):
<asp:TextBox runat="server" Width="200px" ID="DayOff" />
<asp:RangeValidator runat="server" ID="ValidateDayOff2" ControlToValidate="DayOff"
MinimumValue="01/01/2012" MaximumValue="31/12/2012" Type="Date"
ErrorMessage="The date value is not within the specified range" Display="dynamic"
SetFocusOnError="True">*
</asp:RangeValidator>
The RangeValidator control checks that the input value is within the specified range.
It has three specific properties:
Properties | Description |
---|---|
Type | It defines the data type. The following values are available: Currency, Date, Double, Integer and String. |
MinimumValue | Specifies the minimum value of the range. |
MaximumValue | Specifies the maximum value of the range. |