Range Validator Control in asp.net
For Example: Write a program to demonstrate the use of Range validator
<html >
<head runat="server">
<title>Aryan Computers( Range Validator control) </title>
</head>
<body>
<form id="form1" runat="server">
<center>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="XX-Large"
ForeColor="#CC0066" Text="Aryan Computers, Barshi"></asp:Label>
</center>
<p>
<asp:Label ID="Label2" runat="server" Font-Bold="True"
Text="Use of Range Validator:"></asp:Label>
</p>
<asp:Label ID="Label3" runat="server" Text="Roll No:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Height="25px"
style="margin-left: 68px" Width="60px"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="(Enter roll no within 101 to 160 )"
MaximumValue="160" MinimumValue="101"></asp:RangeValidator>
<p>
<asp:Label ID="Label4" runat="server" Text="Name of Student:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"
style="margin-left: 14px; margin-bottom: 0px" Width="285px" Height="26px"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" Font-Bold="True" Height="31px"
Text="Save" Width="87px" />
</form>
</body>
</html>
Output:

Comments
Post a Comment