Timer: The timer control will execute client side event s at specific interval and allows specific part so your page to update or refresh at these moments.

How we implement the Timer server control

 Step1: we use the following control on aspx page 

  <form id="form1" runat="server">
    <%--Using ScriptManger Control--%>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    <%--Using UpdatePanel Control--%>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- Using Label And Timer Control inside UpdatePanel--%>
    <asp:Label ID="lblDateTime" runat="server" Text=""> </asp:Label>
    <asp:Timer ID="Timer1"runat="server"Interval="9000"OnTick= "Timer1_Tick">

 Step2: We write the following code on Timer1_Tick event.

 protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
lblDateTime.Text ="Start DateTime: "+ DateTime.Now.ToString();
protected void Timer1_Tick(object sender, EventArgs e)
lblDateTime.Text ="By Timer: "+ DateTime.Now.ToString();

  Step3: Run the project 


ASP.Net AJAX Server Control: Timer

After Sometimes, the output is:


ASP.Net AJAX Server Control: Timer This is the simple example of Timer and UpdatePanel control, how we use these control in our web based project or window based project.

  Modified On Mar-04-2020 03:48:22 AM

Leave Comment