I have 3 text boxes in an AJAX Update Panel. All user inputs have the Postback property set to True. After I type something in TextBox1 and press the "Tab" key I am setting the focus to TextBox2, and so on. The problem is if they type some data in TextBox1 and instead of pressing "Tab" they mouse click on TextBox3 the cursor goes to TextBox2 instead of having focus on TextBox3. PLEASE HELP!
DEFAULT.ASPX.VB CODE:
Partial Class _Default
Inherits System.Web.UI.Page
Dim ControlName As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack = False Then
TextBox1.Focus()
End If
End Sub
Protected Sub SetNextQRControl(ByVal fld As Control)
ScriptManager1.SetFocus(fld)
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
SetNextQRControl(TextBox2)
End Sub
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
SetNextQRControl(TextBox3)
End Sub
Protected Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
SetNextQRControl(TextBox1)
End Sub
End Class
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
DEFAULT.ASPX CODE:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!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>Set Focus - AJAX Script Manager and Update Panel</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
TabIndex="1"></asp:TextBox><br />
<br />
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"
TabIndex="2"></asp:TextBox><br />
<br />
<asp:TextBox ID="TextBox3" runat="server" AutoPostBack="True"
TabIndex="3"></asp:TextBox><br />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>