在ASP.NET中使用计时器控件

编程入门 行业动态 更新时间:2024-10-14 04:23:56
本文介绍了在ASP.NET中使用计时器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

--------------------------USE OF TIMER CONTROL IN ASP.NET(VB)--------------------------------------------------- <table runat ="server" style="width: 818px" > <tr> <td> &nbsp;</td> <td> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="1000"> </asp:Timer> </div> <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="UpdatePanel1 not refreshed yet."></asp:Label> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Label ID="Label2" runat="server" Text="UpdatePanel2 not refreshed yet."></asp:Label> </ContentTemplate> </asp:UpdatePanel> </td> <td> &nbsp;</td> <td> &nbsp;</td> <td> &nbsp;</td> </tr> </table>

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = "UpdatePanel1 refreshed at: " & _ DateTime.Now.ToLongTimeString() 'Label2.Text = "UpdatePanel2 refreshed at: " & _ ' DateTime.Now.ToLongTimeString() Dim tickCount As Integer = 0 If ViewState("TickCount") IsNot Nothing Then tickCount = CType(ViewState("TickCount"), Integer) End If tickCount += 1 ViewState("TickCount") = tickCount ' Decide whether to disable the timer. If tickCount > 120 Then Label1.Text = "Time is Over!!!!!!!" Timer1.Enabled = False End If End Sub

推荐答案

Google揭示了所有内容: msdn.microsoft/en-us/library/bb386404.aspx [ ^ ] 在asp中使用计时器"的646,000条结果 [ ^ ] Google reveals all: msdn.microsoft/en-us/library/bb386404.aspx[^] 646,000 results for "using timers in asp" [^]

您正在尝试仅提及Code,并且仅此而已.这是你的问题吗?您刚刚提出了另一个问题有 [ ^ ],方法相同,没有任何区别具体细节. 如果您有任何疑问,请提及它,否则仅发布代码将无济于事. You are trying to mentioned only Code and have not mentioned anything more. is it your question? you''ve just posetd another question there[^] in same manner without any specific details. if you have any query so please mention it otherwise posting only code will not help you.

更多推荐

在ASP.NET中使用计时器控件

本文发布于:2023-11-25 00:29:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计时器   控件   ASP   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!