避免从父更新面板刷新子更新面板

时间:2013-11-08 10:21:36

标签: c# asp.net

我正在使用母版页。我在UpdatePanel中的contentplaceholder。在我的内容页面中 我保留数据。某些数据位于另一个更新面板中。在内容页面中有 一个按钮。当按钮单击事件触发时,它也会刷新子更新面板。我不希望这种情况发生。我怎样才能实现它?

Code

母版页

<UpdatePanel>
   <asp:contentplaceholder id="c1">  </contentplaceholder>
<UpdatePanel>

        <asp:content id="content" contentplaceholderid="c1">  
    // This button fire the event
               <asp:button> </asp:button>
    // Don't want to refresh this panel.
               <UpdatePanel id="childUpdatePanel" UpdateMode="Conditional">  
               </UpdatePanel>
        </asp:content>

2 个答案:

答案 0 :(得分:0)

使用像这样的更新面板

母版页

<asp:contentplaceholder id="c1">  </contentplaceholder>

   <asp:content id="content" contentplaceholderid="c1">  
   // This button fire the event
   <UpdatePanel>
           <asp:button> </asp:button>
   </UpdatePanel>
// Don't want to refresh this panel.
           <UpdatePanel id="childUpdatePanel" UpdateMode="Conditional">  
           </UpdatePanel>
    </asp:content>

答案 1 :(得分:0)

你可以在母版页中再添加一个内容面板,如下所示

母版页

   <UpdatePanel>
     <asp:contentplaceholder id="c1">  </contentplaceholder>
   <UpdatePanel>
   <asp:contentplaceholder id="c4">  </contentplaceholder>

    <asp:content id="content" contentplaceholderid="c1">  

           <asp:button> </asp:button>

    </asp:content>

    <asp:content id="content" contentplaceholderid="c4">  
       <UpdatePanel id="childUpdatePanel" UpdateMode="Conditional">  
       </UpdatePanel>
    </asp:content>
相关问题