Bruce
asked on
How do I set focus to a textbox inside a Gridview Footer inside an UpdatePanel?
I am using a footer in a GridView to "add" items to the gridview via a textbox and button combination and the GridView is inside an UpdatePanel. That's working fine.
What I would like to do is have the textbox receive focus after the partial page update. How can I do that?
Is there an event on the UpdatePanel I can capture/code that will do this?
What I would like to do is have the textbox receive focus after the partial page update. How can I do that?
Is there an event on the UpdatePanel I can capture/code that will do this?
<asp:UpdatePanel ID="upnlEditUsers" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlUsers" runat="server" Height="300" style="text-align:left;">
<asp:GridView ID="gvUsers" runat="server"
CellPadding="3" CellSpacing="0"
Width="350px"
PagerStyle-HorizontalAlign="center"
AutoGenerateColumns="false"
ShowFooter="true"
ShowHeader="true"
OnRowCommand="gvUsers_RowCommand"
DataKeyNames="PersonID, RequestID"
OnRowDataBound="gvUsers_RowDataBound"
>
<AlternatingRowStyle CssClass="altRowStyle" />
<RowStyle CssClass="RowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<EmptyDataRowStyle />
<Columns>
<asp:TemplateField HeaderText="User(s)" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblUserFullName" runat="server" Text='<%# Bind("UserFullName") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="tbxPersonSearch" runat="server" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="3"
TargetControlID="tbxPersonSearch"
ServiceMethod="PersonSearchLastName" ServicePath="~/WebServices/AutoComplete.asmx"
CompletionSetCount="30"
OnClientItemSelected="PersonSearchItemSelected"
FirstRowSelected="false"
>
</cc1:AutoCompleteExtender>
<asp:Button ID="btnAddPersonToRequest" Text="Add" runat="server" OnClick="btnAddPersonToRequest_Click" OnClientClick="javascript:EnableValidators(false);" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-BorderColor="#CCCCCC" ItemStyle-BorderColor="#CCCCCC"
ItemStyle-HorizontalAlign="center" Visible="true">
<ItemTemplate>
<asp:ImageButton AlternateText="Remove User" ID="btnRemoveUser" ImageUrl="~/Images/delete.ico"
CausesValidation="false" CommandName="Remove" CommandArgument='<%# Bind("PersonID") %>'
runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<div style="margin: 5px 5px 5px;" ><asp:Label ID="lblNoUsers" Text="There are no users associated with this request." runat="server"></asp:Label></div>
<asp:TextBox ID="tbxPersonSearch" style="margin-left: 5px;" runat="server" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="3"
TargetControlID="tbxPersonSearch"
ServiceMethod="PersonSearchLastName" ServicePath="~/WebServices/AutoComplete.asmx"
CompletionSetCount="30"
OnClientItemSelected="PersonSearchItemSelected"
FirstRowSelected="true"
>
</cc1:AutoCompleteExtender>
<asp:Button ID="btnAddPersonToRequest" Text="Add" runat="server" OnClick="btnAddPersonToRequest_Click" />
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.