In this article I will explain acerda the RangeValidator in ASP.NET. This type of control in ASP.NET allows us to determine ranges of values.
Getting Started
What is RangeValidator Control?
The RangeValidator control allows you to check whether a user’s entry is between a specified upper and lower boundary. You can check ranges within pairs of numbers, alphabetic characters, and dates. Boundaries are expressed as constants.
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtAge" ErrorMessage="Age between 18-45" MaximumValue="45" MinimumValue="18">* </asp:RangeValidator>
Example
This example determines whether the age to be entered is in the set range. In this test we will add a text box, a label and a button:
Then, add the RangeValidator control, and a ValidationSummary Control (show error messages):
Use the ControlToValidate property to specify the input control to validate. The MinimumValue and MaximumValue properties specify the minimum and maximum values of the valid range, respectively.
Follow these properties:
The result would be something like this:
This concludes RangeValidator in ASP.NET.
Looking for quality Windows Hosting? Look no further than Arvixe Web Hosting!
Happy Hosting
Rodolfo Hernandez