当前位置: 代码迷 >> ASP.NET >> 使用Timer控制两个UpdatePanel中的一个,该怎么处理
  详细解决方案

使用Timer控制两个UpdatePanel中的一个,该怎么处理

热度:2341   发布时间:2013-02-25 00:00:00.0
使用Timer控制两个UpdatePanel中的一个
使用Timer控制两个UpdatePanel中的我有2个UpdatePanel 有1个Timer  
 用Timer执行定时刷新个UpdatePanel1  
但是 Timer却影响了我的两个UpdatePanel2  
当把放在UpdatePanel2里面的控件拖动到UpdatePanel2外部,则没有影响!  
有什么办法使用Timer控制两个UpdatePanel中的一个  
或者一个Timer只是控制一个UpdatePanel中的一个控件(Timer只是给一个Button计时,其他的不影响)  
请叫各位回答!  

先谢谢了一个

------解决方案--------------------------------------------------------
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

</div>
<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>

</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>

UpdateMode="Conditional">这里要设置 ,,还有 <asp:AsyncPostBackTrigger ControlID="Timer1" />
这样就没问题了 !!!
  相关解决方案