Zack Peterson
Zack Peterson

Reputation: 57323

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.

Upvotes: 6

Views: 7977

Answers (3)

Zack Peterson
Zack Peterson

Reputation: 57323

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.

Upvotes: 5

SuneelK
SuneelK

Reputation: 101

This is what I do

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

In the code behind after binding UpdatePanel2 Controls with data, call UpdatePanel2.Update(); Ajax updates only HTML markup in "UpdatePanel2".

Upvotes: 2

rick schott
rick schott

Reputation: 20617

<asp:UpdatePanel ID="UpdatePanel1" ChildrenAsTriggers="False"
                 UpdateMode="Conditional"
                 runat="server">

</asp:UpdatePanel>

Upvotes: 6

Related Questions