S
Shooter
Hi,
I'm having problems getting validation controls to set the focus back to the
textbox that caused the error (or any error). Using ASP.Net 2 and IE 6.
Does anyone have a solution to help me out on this one? Heres some code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
SetFocusOnError="true"
ErrorMessage="TextBox1 is empty" ControlToValidate="TextBox1"
runat="server"/><br />
<asp:TextBox ID="TextBox2" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
SetFocusOnError="true"
ErrorMessage="TextBox2 is empty" ControlToValidate="TextBox2"
runat="server"/>
<br />
<asp:Button ID="Button1" runat="server" Text="Button"
CausesValidation="true"/>
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
ShowMessageBox="True"
ShowSummary="False" />
</div>
</form>
</body>
</html>
I'm having problems getting validation controls to set the focus back to the
textbox that caused the error (or any error). Using ASP.Net 2 and IE 6.
Does anyone have a solution to help me out on this one? Heres some code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
SetFocusOnError="true"
ErrorMessage="TextBox1 is empty" ControlToValidate="TextBox1"
runat="server"/><br />
<asp:TextBox ID="TextBox2" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
SetFocusOnError="true"
ErrorMessage="TextBox2 is empty" ControlToValidate="TextBox2"
runat="server"/>
<br />
<asp:Button ID="Button1" runat="server" Text="Button"
CausesValidation="true"/>
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
ShowMessageBox="True"
ShowSummary="False" />
</div>
</form>
</body>
</html>