在父面板树的选择上,我在parent UpdatePanel中有一个树,我正在启用/禁用子UpdatePanel按钮。但为什么不会呢?如何在父updatepanel内容事件中更新子面板内容?
<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:UpdatePanel>发布于 2011-02-22 13:33:06
指定UpdateMode="Conditional"时,需要在父UpdatePanel上设置UpdateMode="Conditional"
发布于 2011-02-22 16:41:57
在您的示例中,如果在ParentUpdatePanel.中触发回发事件,ChildUpdatePanel将自动更新
启用/禁用btn1不工作的唯一原因是您使用的控件不会触发回发事件。因此,您可能希望在客户端启用/禁用更改。
这是我的解决方案。
如果它起作用了,请告诉我。
`$(document).ready(function () { $('input[type = "checkbox"]').click(function () { $('input[id$="btnChild"]').toggle(); }); });` <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>https://stackoverflow.com/questions/5074291
复制相似问题