繁体   English   中英

如何在更新母版页时防止内容页被更新?

[英]How to prevent content page from being updated when the master page is updated?

我在母版页中有一个UpdatePanel,在内容页中有另一个。 当我使用Timer刷新母版页时,具有自己的Timer的内容页也会被更新。

问题1:如何防止母版页中的刷新更新内容页?

问题2:内容页面中的Timer间隔设置为60000。加载页面时,我必须等待60000才能看到显示的GridView数据。 如何在页面加载后立即显示数据,然后每60000刷新一次数据?

Site.Master:

 <asp:ScriptManager ID="ScriptManagerMouseRegion" runat="server"></asp:ScriptManager>

 <asp:Timer runat="server" id="SiteMasterTimer" Interval="10000" OnTick="SiteMasterTimer_Tick"></asp:Timer> 

 <asp:UpdatePanel ID="UpdatePanelMouseRegion" runat="server">
                <ContentTemplate>  
// mouse region to be updated

Default.aspx:

<asp:ScriptManagerProxy ID="DisplayResultsScriptManager" runat="server">
</asp:ScriptManagerProxy>

<asp:Timer ID="DisplayResultsTimer" Interval="60000" Enabled="true" runat="server" OnTick="DisplayResultsTimer_Tick"> 
</asp:Timer> 

<asp:UpdatePanel ID="DisplayResultsUpdatePanel" runat="server" >
   <Triggers>
        <asp:AsyncPostBackTrigger ControlID="DisplayResultsTimer" />  
   </Triggers>

    <ContentTemplate>

    // GridView to be updated

对于updatePanels,将UpdateMode设置为Conditional

<asp:UpdatePanel ID="UpdatePanelMouseRegion" runat="server" UpdateMode="Conditional">

有关更多信息: 创建带有多个UpdatePanel控件的简单ASP.NET页

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM