No, you can attach a client-side event handler like
myTextBox.Attributes["onfocus"] = "gotFocus(this)";
and in .aspx file:
<input type = "hidden" runat="server" id="inhControlWithFocus" />
and in javascript
function gotFocus(control)
{
myForm.inhControlWithFocus.value = control.Id;
}

Signature
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
> On Apr 17, 3:35 am, "Eliyahu Goldin"
> <REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.org> wrote:
[quoted text clipped - 107 lines]
> Sorry to be a pain. I am using a Textbox control. Will I need to use
> a different control instead to get an OnFocus method?
Mel - 17 Apr 2008 17:25 GMT
On Apr 17, 8:57 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.org> wrote:
> No, you can attach a client-side event handler like
> myTextBox.Attributes["onfocus"] = "gotFocus(this)";
[quoted text clipped - 129 lines]
> > Sorry to be a pain. I am using a Textbox control. Will I need to use
> > a different control instead to get an OnFocus method?
The hidden text box always says "undefined". I am doing something
wrong.
<%@ 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>
<script type="text/javascript">
function gotFocus(control)
{
document.getElementById("inhControlWithFocus").value=control.Id;
}
</script>
<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" OnTextChanged="TextBox1_TextChanged"
TabIndex="1"></asp:TextBox><br />
<br />
<asp:TextBox ID="TextBox2" runat="server"
AutoPostBack="True" OnTextChanged="TextBox2_TextChanged"
TabIndex="2"></asp:TextBox><br />
<br />
<asp:TextBox ID="TextBox3" runat="server"
AutoPostBack="True" OnTextChanged="TextBox3_TextChanged"
TabIndex="3"></asp:TextBox><br />
<br />
<input runat="server" id="inhControlWithFocus" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
TextBox1.Attributes("onfocus") = "gotFocus(this)"
TextBox2.Attributes("onfocus") = "gotFocus(this)"
TextBox3.Attributes("onfocus") = "gotFocus(this)"
End Sub
Protected Sub SetNextQRControl()
ScriptManager1.SetFocus(inhControlWithFocus.ID)
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
'Session("QRNextControl") = 2
SetNextQRControl()
End Sub
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
'Session("QRNextControl") = 3
SetNextQRControl()
End Sub
Protected Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
'Session("QRNextControl") = 1
SetNextQRControl()
End Sub
End Class