当前位置: 编程技术>.net/c#/asp.net
asp.net Timer定时器用法示例
来源: 互联网 发布时间:2014-08-30
本文导语: asp.net Timer定时器用法 1,页面代码: Untitled Page #UpdatePanel3 { border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid; border-bottom: gray 1px solid; width:200px; height:200px; position: relative; float: left; margin-le...
asp.net Timer定时器用法
1,页面代码:
Untitled Page
#UpdatePanel3 {
border-right: gray 1px solid; border-top: gray 1px solid;
border-left: gray 1px solid; border-bottom: gray 1px solid;
width:200px; height:200px; position: relative;
float: left; margin-left: 10px; margin-top: 10px;
}
asp.net Timer定时器用法:
2,cs文件代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label4.Text = "初始化时间:" + DateTime.Now.ToString();
Timer1.Interval = 1000;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label3.Text = "刷新时间:" + DateTime.Now.ToString();
}
}
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label4.Text = "初始化时间:" + DateTime.Now.ToString();
Timer1.Interval = 1000;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label3.Text = "刷新时间:" + DateTime.Now.ToString();
}
}