I tested it and found it worked fine in Ajax RC 1.0.This is a?known issue to set focus through ScriptManager.SetFocus(control) in Ajax Beta 2.Try to download Ajax RC 1.0 and this should work fine.
Here are my simple testing codes for your reference.
<div>
<asp:UpdatePanel ID="upnlFocus" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td><asp:Label ID="lblWelcome" runat="server" Text="Welcome to apply Ajax Technology"></asp:Label></td>
<td><asp:TextBox ID="tbWelcome" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" /></td>
<td><asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
Behind Codes:
protected void btnUpdate_Click(object sender, EventArgs e)
{
upnlFocus.Update();
ScriptManager1.SetFocus(tbWelcome);
}
Wish the above can help you.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment