Mega Code Archive

 
Categories / ASP.Net / Validation By Control
 

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>