The RangeValidator control is used to check that the userenters an input value that falls between two values. It is possible to checkranges within numbers, dates, and characters.
Example
<form id="form1"runat="server">
<asp:TextBox ID="TextBox1" runat="server"
style="z-index: 1; left: 60px; top: 55px; position: absolute"></asp:TextBox>
<asp:Button ID="Button1" runat="server"
style="z-index: 1; left: 96px; top: 109px; position: absolute" Text="Button" />
//applyingrange validator on TextBox1. Range should be between 20 to 50, otherwise itwill display error message.
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="* value should be between 20 to 50"
style="position:absolute; top: 159px; left: 60px; width: 209px;"
ControlToValidate="TextBox1" MaximumValue="50" MinimumValue="20" Type="Integer"></asp:RangeValidator>
</form>
Leave Comment