ASP .NET UpdatePanel in dynamically loaded control

1.5k Views Asked by At

Currently we have an UpdatePanel containing a Panel as follows:

<asp:UpdatePanel ID="updatepanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="panel" runat="server">
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>

We then dynamically load a custom control using LoadControl() into the Panel. To complicate matters the custom control contains its own UpdatePanel.

The problem I am facing at the moment is - how I update the inner UpdatePanel without having the outer UpdatePanel refresh? The UpdateMode is set to Conditional on both. Many thanks in advance for your help!

1

There are 1 best solutions below

0
On

Have you tried setting ChildrenAsTriggers=false for the parent update panel?

http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers

Automatic child trigger inclusion can also be disabled (so that child controls that create postbacks do not automatically trigger partial renders) by setting the ChildrenAsTriggers property to false. This allows you the greatest flexibility in assigning which specific controls may invoke a page render, and is recommended, so that a developer will opt-in to respond to an event, rather than handling any events that may arise.

Note that when UpdatePanel controls are nested, when the UpdateMode is set to Conditional, if the child UpdatePanel is triggered, but the parent is not, then only the child UpdatePanel will refresh. However, if the parent UpdatePanel is refreshed, then the child UpdatePanel will also be refreshed.