Unable to find control in Update Panel for trigger
14,172
Your button are located inside other controls. You should specify namingcontainer hierarchy for update panel trigger. I think this helps you:
<asp:PostBackTrigger ControlID="TabContainer1$tabCompanyName$btnStateExportToExcel" />
Author by
Richa
Updated on June 05, 2022Comments
-
Richa almost 2 years
In our application of asp.net with c#, we are using Ajax with update panel control. In panel, we have put export to excel button inside tab panel.
We have also put triggers after ending of content template. Please find below code for your reference.
<asp:UpdatePanel ID="UpdatePanelPage" runat="server" UpdateMode="Conditional"> <ContentTemplate> <table id="tblMain" runat="server" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <asp:TabContainer ID="TabContainer1" runat="server" Width="100%"> <asp:TabPanel ID="tabCompanyName" runat="server"> <asp:Button ID="btnStateExportToExcel" runat="server" Text="Export To Excel" CssClass="button" OnClick="btnStateExportToExcel_Click" /> </asp:TabPanel> </asp:TabContainer> </td> </tr> </table> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnStateExportToExcel" /> </Triggers> </asp:UpdatePanel>
Now when we run the page following error would be display. “A control with ID 'btnStateExportToExcel' could not be found for the trigger in UpdatePanel 'UpdatePanelPage'.“ Any idea/suggestion would be highly appreciable.
*As per search results of Google, the button resides in tab panel due to which page was not able to find this control.