首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在父updatepanel内容事件中更新子面板内容?

问如何在父updatepanel内容事件中更新子面板内容?
EN

Stack Overflow用户
提问于 2011-02-22 13:13:52
回答 2查看 758关注 0票数 0

在父面板树的选择上,我在parent UpdatePanel中有一个树,我正在启用/禁用子UpdatePanel按钮。但为什么不会呢?如何在父updatepanel内容事件中更新子面板内容?

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

发布于 2011-02-22 13:33:06

指定UpdateMode="Conditional"时,需要在父UpdatePanel上设置UpdateMode="Conditional"

票数 0
EN

Stack Overflow用户

发布于 2011-02-22 16:41:57

在您的示例中,如果在ParentUpdatePanel.中触发回发事件,ChildUpdatePanel将自动更新

启用/禁用btn1不工作的唯一原因是您使用的控件不会触发回发事件。因此,您可能希望在客户端启用/禁用更改。

这是我的解决方案。

如果它起作用了,请告诉我。

代码语言:javascript
复制
     `$(document).ready(function () {         $('input[type = "checkbox"]').click(function () {             $('input[id$="btnChild"]').toggle();         });     });`   
代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5074291

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档