Set Focus On Error : RangeValidator « Validation by Control « ASP.Net






Set Focus On Error

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label4" runat="server" Text="The Following Field (TextBox4) Must be an Integer Between 1 and 10"></asp:Label><br />
        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        <asp:RangeValidator ID="RangeValidator1" 
                            runat="server" 
                            ControlToValidate="TextBox4"
                            ErrorMessage="TextBox4 Must be an Integer Between 1 and 10" 
                            MaximumValue="10"
                            MinimumValue="1" 
                            SetFocusOnError="True">*</asp:RangeValidator><br />
    </div>
    </form>
</body>
</html>

 








Related examples in the same category

1.Validation test: range (C#)
2.Rangevalidator: Enter an integer between 0 and 100 (VB.net)
3.RangeValidator Demo: The Quantity field must be from 1 to 30! (VB.net)
4.Range validator for Date type value
5.RangeValidator for integer type value