Search code examples
.netasp.netajaxasp.net-ajaxupdatepanel

Nested UpdatePanel Triggers


My child UpdatePanel updates both its contents and those of its parent UpdatePanel.

<asp:UpdatePanel ID="UpdatePanel1" 
                 runat="server">
    ...
    <asp:UpdatePanel ID="UpdatePanel2" 
                     runat="server">
        ...
    </asp:UpdatePanel>
    ...
</asp:UpdatePanel>

I don't want my parent UpdatePanel to be updated every time its child updates.


Solution

  • Set the UpdatePanel.UpdateMode Property to Conditional.

    <asp:UpdatePanel ID="UpdatePanel1" 
                     UpdateMode="Conditional"
                     runat="server">
        ...
    </asp:UpdatePanel>
    

    Project Cool:

    Child Update Panel refreshes only its contents and doesnt refresh that of the Parent Update Panel unless, the update mode for the parent update panel is not set to Conditional

    CodeClimber:

    When set to Conditional, the UpdatePanel will be updated only on postback originated by controls inside the panel or from the triggers specified. So, if you have multiple update panels and you don't want to update all of them to be updated every time, you have to set the UpdateMode to Conditional.