Javatpoint Logo
Javatpoint Logo

ASP.NET RangeValidator Control

This validator evaluates the value of an input control to check that the value lies between specified ranges.

It allows us to check whether the user input is between a specified upper and lower boundary. This range can be numbers, alphabetic characters and dates.

Note: if the input control is empty, no validation will be performed.

The ControlToValidateproperty is used to specify the control to validate. The MinimumValue and MaximumValue properties are used to set minimum and maximum boundaries for the control.

RangeValidator Properties

Property Description
AccessKey It is used to set keyboard shortcut for the control.
TabIndex The tab order of the control.
BackColor It is used to set background color of the control.
BorderColor It is used to set border color of the control.
BorderWidth It is used to set width of border of the control.
Font It is used to set font for the control text.
ForeColor It is used to set color of the control text.
Text It is used to set text to be shown for the control.
ToolTip It displays the text when mouse is over the control.
Visible To set visibility of control on the form.
Height It is used to set height of the control.
Width It is used to set width of the control.
ControlToValidate It takes ID of control to validate.
ErrorMessage It is used to display error message when validation failed.
Type It is used to set datatype of the control value.
MaximumValue It is used to set upper boundary of the range.
MinimumValue It is used to set lower boundary of the range.


In the following example, we are using RangeValidator to validate user input in specified range.

// RangeValidator.aspx


ASP Range 1

It throws an error message when the input is not in range.

ASP Range 2

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA