i have a tree in parent UpdatePanel on selection of Parent panel tree i am enablling/disabling the child UpdatePanel button. but it does'nt why? how to update child panel content on event of parent updatepanel content event?
<asp:UpdatePanel runat="server" ID="parentPanel" UpdateMode="conditional">
<ContentTemplate>
<asp:TreeView id="tree1" runat="server"></asp:TreeView>
<div id="div_RemitEditor" style="width:225px; display: none;">
<asp:UpdatePanel ID="childUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button id="btn1" runat="server"></asp:Button>
<Content>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:TreeView id="tree2" runat="server"></asp:TreeView>
</ContentTemplate>
</asp:Upda开发者_开发问答tePanel>
You need to set ChildrenAsTriggers="true"
on parent UpdatePanel when you specify UpdateMode="Conditional"
In your case, ChildUpdatePanel will automatically update if a Postback Event is triggered in ParentUpdatePanel.
The only reason that enable/disable btn1 not working is that the control you are using doesn't trigger a Postback Event. Therefore, you might want change enable/disable on client side.
Here is my solution.
Let me know if it works.
<asp:ScriptManager ID="MainScriptManager" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel id="parentPanel" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:TreeView ID="tree1" runat="server" ShowCheckBoxes="All">
<Nodes>
<asp:TreeNode Checked="true" Expanded="true" Text="Toggle Child Button" >
<asp:TreeNode Text="Child" ShowCheckBox="true">
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<div id="div_RemitEditor">
<asp:UpdatePanel ID="childUpdatePanel" runat = "server">
<ContentTemplate>
<asp:Button ID="btnChild" runat="server" Text = "Child Button"/>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
精彩评论