Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find UpdatePanel with ID 'xxx'. If it is being updated dynamically then it must be inside another UpdatePanel

I have a page with Ajax Tab controls, within one of the tabs is a webcontrol that as a Telerik RadGrid, with Edit forms pointing to another web control. That edit form also contains Ajax Tabs and on one of those tabs, there is an Ajax modal popup of yet another webcontrol.

The initial webcontrol works fine when used on its own page, but the edit form fails to appear when the control is used within the Ajax Tabs as desired. The script manager is throwing the following error:

Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'xxx'. If it is being updated dynamically then it must be inside another UpdatePanel.

Any assistance with this would be appreciated.

like image 658
Amy Young Avatar asked Oct 13 '10 21:10

Amy Young


4 Answers

This issue occurs in Telerik RadAjaxManager when you adds invisible controls to it.

So in case of your in need to show/hide AJAX controls, it is recommended to add AJAX settings grammatically from you code behind (based on control visibility state) instead of ASPX code.

For more information: Please check this answer on the Telerik forums.

like image 108
Mohamed Ramadan Avatar answered Nov 18 '22 13:11

Mohamed Ramadan


Well, I am considering this error is coming in your script. If you are showing/hiding the update panel then it will give this error. The best solution is known to me which worked too is put your update panel into the content template of the other update panel which will be the parent of the update panel that you are showing/hiding.

<asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:UpdatePanel ID="Panel2" runat="server" UpdateMode="Conditional">
             <ContentTemplate>
                 <asp:Label ID="labwl1" runat="server" Text="Label">
                 </asp:Label>
             </ContentTemplate>
        </asp:UpdatePanel >
    </ContentTemplate>
</asp:UpdatePanel >

Now if you will hide the update panel with id Panel2 it won't give any error.

like image 41
ahmar Avatar answered Nov 18 '22 15:11

ahmar


To start off with the troubleshooting, I personally will try to remove parts of the code and thus designate the reason for the error. For example, remove the grid and load the user control dynamically on tab click to see if the problem remains, then remove the inner ajax tab or the modal popup and perform another check, etc.

like image 2
Dick Lampard Avatar answered Nov 18 '22 14:11

Dick Lampard


In most of the cases - If container/Parent of that update panel is trRow and you have somewhere in code like trRow.Visible = false; then It wont find said updatepanel and throw error.

like image 4
Sumit Kapadia Avatar answered Nov 18 '22 15:11

Sumit Kapadia