asp.netTimer的使用方法
2023-06-13 09:14:03 时间
页面代码:
复制代码代码如下:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%>
<%@RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>UntitledPage</title>
<styletype="text/css">
#UpdatePanel3{
border-right:gray1pxsolid;border-top:gray1pxsolid;
border-left:gray1pxsolid;border-bottom:gray1pxsolid;
width:200px;height:200px;position:relative;
float:left;margin-left:10px;margin-top:10px;
}
</style>
</head>
<body>
<formid="form1"runat="server">
<asp:ScriptManagerID="ScriptManager1"runat="server"/>
<asp:UpdatePanelID="UpdatePanel3"runat="server">
<ContentTemplate>
<asp:TimerID="Timer1"runat="server"Interval="1000"OnTick="Timer1_Tick">
</asp:Timer>
<asp:LabelID="Label3"runat="server"Text="Label"></asp:Label><br/>
</ContentTemplate>
</asp:UpdatePanel>
<asp:LabelID="Label4"runat="server"Text="Label"></asp:Label>
</form>
</body>
</html>
cs文件代码:
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
usingSystem.Threading;
publicpartialclass_Default:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
Label4.Text="初始化时间:"+DateTime.Now.ToString();
Timer1.Interval=1000;
}
protectedvoidTimer1_Tick(objectsender,EventArgse)
{
Label3.Text="刷新时间:"+DateTime.Now.ToString();
}
}
相关文章
- ASP.NET中使用UpdatePanel实现局部异步刷新方法和攻略「建议收藏」
- 使用 ASP 连接 MS SQL 服务器(asp连接mssql)
- 数据库使用 ASP 读取 MySQL 数据库的实现方法(asp读取mysql)
- 在MySQL5中使用ASP搭建数据库连接(asp连接mysql5)
- 企业网站用ASP读取MySQL数据持续发展(asp网站读取MySQL)
- 使用MySQL轻松实现ASP数据库应用(asp数据库用mysql)
- 数据库探索ASP环境搭建MySQL数据库方法(asp搭建mysql)
- 利用ASP技术进行MySQL数据库开发(asp可以使用mysql)
- 使用ASP连接Oracle数据源的简便方式(asp数据源oracle)
- 几例在ASP存储过程的使用方法
- ASP.NET中文件上传下载方法集合
- ASP.NET2.0服务器控件之Render方法
- 用ASP打开远端MDB文件的方法
- asp.net相关文章实现方法
- asp经典入门教程在ASP中使用SQL语句
- ASP.NET缓存管理的几种方法
- 使用asp.net的pageDataSource中时索引问题解决方法
- asp.netLC.exe已退出代码为-1的原因分析及解决方法
- Asp.net中把Excel数据存储至SQLServer中的具体实现方法
- asp.net利用NamingContainer属性获取GridView行号的方法
- ASP.NET设置404页面返回302HTTP状态码的解决方法
- ASP.NET中使用Ajax的方法
- 解读ASP.NET密码强度验证代码实例分享
- ASP.NET中水晶报表的使用方法详解
- ASP随机数RND()使用方法
- 在(ASP/PHP/JSP/html/js)中禁止ajax缓存的方法集锦
- asp.net实现access数据库分页的方法
- asp.net利用后台实现直接生成html分页的方法
- ASP.NET使用TreeView显示文件的方法