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

前端 未结 10 1470
终归单人心
终归单人心 2021-02-05 10:08

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 cont

相关标签:
10条回答
  • 2021-02-05 10:09

    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.

    0 讨论(0)
  • 2021-02-05 10:10

    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.

    0 讨论(0)
  • 2021-02-05 10:14

    In my case I had 2 update panels on the page, but only 1 of them had an ID. Setting an ID for the other one resolved the error.

    0 讨论(0)
  • 2021-02-05 10:16

    My page contains a few updatepanels. I fixed this error by making sure all of them were visible and didn't have display:none.

    You can find which panel is causing the error by viewing the source of the page and searching for the ID the error is giving you.

    0 讨论(0)
  • 2021-02-05 10:20

    I resolved the issue by removing the UpdatePanel on the initial tab that contained the WebControl. I'm not clear on why this should have caused the issue though so if anyone can explain that, I'd be interested to find out.

    So, for example, I originally had this:

    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" OnClientActiveTabChanged="TabContainer1_OnChanged"  Visible="true"  >
         <cc1:TabPanel runat="server" ID="TabPriorities">
               <HeaderTemplate>Manage Prioritys</HeaderTemplate>
               <ContentTemplate>
                     <asp:UpdatePanel ID="UpdatePanelPriorities" runat="server" UpdateMode="Conditional">
                       <ContentTemplate>
                          <uc1:PriorityGrid ID="PriorityGrid1" runat="server" />
                       </ContentTemplate>
                     </asp:UpdatePanel>
                </ContentTemplate>
          </cc1:TabPanel>
    

    And I changed it to:

    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" OnClientActiveTabChanged="TabContainer1_OnChanged"  Visible="true"  >
         <cc1:TabPanel runat="server" ID="TabPriorities">
               <HeaderTemplate>Manage Prioritys</HeaderTemplate>
               <ContentTemplate>
    
                          <uc1:PriorityGrid ID="PriorityGrid1" runat="server" />
    
                </ContentTemplate>
          </cc1:TabPanel>
    

    And that resolved the script error coming out of the user control which also contained ajax tabs and a modal popup.

    0 讨论(0)
  • 2021-02-05 10:24

    EDIT: I'd like to revise my answer based on some new things I discovered while working with update panels in UpdateMode="Conditional".

    This is still in context of addressing the OP's issue of encountering the above error.

    The scenario for me is that I have a parent update panel with several nested child update panels:

        <asp:UpdatePanel ID="upParent" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <%-- Header Content --%>
                <asp:UpdatePanel ID="upChild1" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <%-- Child1 Content --%>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="upChild2" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <%-- Child2 Content --%>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:Button ID="btnEditMode" runat="server" Text="Edit" OnClick="btnEditMode_Click"></asp:Button>
            </ContentTemplate>
        </asp:UpdatePanel>
    

    In order for the Edit button to change content in both child update panels and also refresh the overall Parent update panel without causing any issues, you might want to consider doing an asynchronous postback:

        <asp:UpdatePanel ID="upParent" runat="server" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnEditMode" EventName="Click" />
            </Triggers>
            <ContentTemplate>
                <%-- Header Content --%>
                <asp:UpdatePanel ID="upChild1" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <%-- Child1 Content --%>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="upChild2" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <%-- Child2 Content --%>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:Button ID="btnEditMode" runat="server" Text="Edit" OnClick="btnEditMode_Click"></asp:Button>
            </ContentTemplate>
        </asp:UpdatePanel>
    

    This works for me, I don't get the above mentioned (OP's) error any longer. Interestingly enough, almost similar to the OP's scenario, I've been working with Ajax Tab Controls and each tab contained child update panels. This is where I've encountered the exact same error message and resolved it by adding the asynchronous post back trigger.

    0 讨论(0)
提交回复
热议问题