ASP.NET更新面板嵌套刷新

时间:2016-12-18 05:27:26

标签: asp.net triggers updatepanel

此代码位于用户控件中。我提供了一个示例代码结构来获得概述。

<Update Panel UpdateMode= "Conditional">
<panel></panel>
<panel>
<button></button>
</panel>
<updatepanel UpdateMode="Conditional"></updatepanel>
</Updatepanel>

所以当我点击第二个面板中的一个按钮时,我应该隐藏该面板并且它正在发生但同时其他面板正在刷新。可能的原因是什么?

1 个答案:

答案 0 :(得分:0)

根据代码段,您可能需要解决几个问题:

  1. 确保您在ScriptManager
  2. 页面上有EnablePartialRendering="true"
  3. 通过在{&#34; asp:&#34;前面添加<UpdatePanel>元素ASP.NET UpdatePanel控件来更正您的标记。
  4. UpdateMode="Conditional"添加到两个UpdatePanel控件
  5. 将要更新的部分异步移动到UpdatePanel控件中。
  6. 实施例

    <asp:ScriptManager ID="MyScriptManager" EnablePartialRendering="true" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="MyUpdatePanel" runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="This is a label!"></asp:Label>
                <asp:Button ID="Button1" runat="server" Text="Click Me" />
            </ContentTemplate>
        </asp:UpdatePanel>
    

    以下文章是了解有关UpdatePanel的详细信息以及有关其功能的详细信息的绝佳资源。

    Understanding Partial Page Updates with ASP.NET AJAX