Page code:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%>
<%@ Register assembly= "AjaxControlToolkit" namespace= "AjaxControlToolkit" tagprefix= "CC1"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd XHTML 1.1//en" "Http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
<title>untitled page</title>
<style type= "Text/css" >
#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;
}
</style>
<body>
<form id= "Form1" runat= "Server" >
<asp:scriptmanager id= "ScriptManager1" runat= "Server"/>
<asp:updatepanel id= "UpdatePanel3" runat= "Server" >
<ContentTemplate>
<asp:timer id= "Timer1" runat= "Server" interval= "1000" ontick= "Timer1_Tick" >
</asp:Timer>
<asp:label id= "Label3" runat= "Server" text= "Label" ></asp:label><br/>
</ContentTemplate>
</asp:UpdatePanel>
<asp:label id= "Label4" runat= "Server" text= "Label" ></asp:Label>
</form>
</body>
CS File Code:
Copy Code code as follows:
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 = "Initialization time:" + DateTime.Now.ToString ();
Timer1.interval = 1000;
}
protected void Timer1_Tick (object sender, EventArgs e)
{
Label3.text = "Refresh time:" + DateTime.Now.ToSt Ring ();
}
}