Nested UpdatePanel: Why ChildrenAsTriggers no effect?

Given the simple case of two nested update panel. They invested, and each of them has a label, filled with the current time in the code behind. I do not understand why the property ChildrenAsTriggers="true" - property on the outer UpdatePanel has no effect? When I click "Refresh embedded panel", while in the parent UpdatePanel is not updated. But, as I understand it, it must be:

 <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" Text = "Update Panel <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " onclick = "ButtonUpdate_Click" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" Text = "Update Nested Panel" <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " onclick = "ButtonUpdateNestedPanel_Click" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" UpdateMode = "Conditional" ChildrenAsTriggers = "true"> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " EventName = "Click" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server"> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " EventName = "Click" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> " runat = "server" /> <asp:ScriptManager ID="ScriptManager1" runat="server" onasyncpostbackerror="ScriptManager1_AsyncPostBackError"> </asp:ScriptManager> <asp:Button ID="ButtonUpdate" runat="server" Text="Update Panel 1" style="margin-top: 15px" onclick="ButtonUpdate_Click" /> <asp:Button ID="ButtonUpdateNestedPanel" runat="server" Text="Update Nested Panel" style="margin-top: 15px" onclick="ButtonUpdateNestedPanel_Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:UpdatePanel ID="UpdatePanelNested" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="LabelNested" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> 

Thanks for any tips! sl3dg3

ps: the code behind:

 protected void ButtonUpdate_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } protected void ButtonUpdateNestedPanel_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } e) protected void ButtonUpdate_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } protected void ButtonUpdateNestedPanel_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } e) protected void ButtonUpdate_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } protected void ButtonUpdateNestedPanel_Click(object sender, EventArgs e) { LabelNested.Text = DateTime.Now.ToString(); Label1.Text = DateTime.Now.ToString(); } 
+5
source share
3 answers

When ChildrenAsTriggers property set to true, and any subsidiary management control UpdatePanel causes postback. Elements of child controls of nested UpdatePanel controls do not cause external update UpdatePanel control if they are not explicitly defined as triggers for the parent panel. http://forums.asp.net/t/1422425.aspx/1

and it should be like ...

 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> ...... ...... " runat = "server" UpdateMode = "Conditional" ChildrenAsTriggers = "true"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> ...... ...... " EventName = "Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> ...... ...... " EventName = "Click" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ButtonUpdate" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="ButtonUpdateNestedPanel" EventName="Click" /> </Triggers> ...... ...... 
0
source

I believe that in order to see the desired effect in action, you have to actually add their buttons as children in the content template. "ChildrenAsTriggers" property applies only to the direct child elements "ContentTemplate" block.

0
source

ChildrenAsTriggers = "true" Set properties ChildrenAsTriggers is true, if you want postbacks from immediate child UpdatePanel controls caused the update panel content. Elements of child controls of nested UpdatePanel controls will not cause update of the parent UpdatePanel control if you call the Update method explicitly or not, define the child controls as triggers elements.

-1
source

All Articles