♣ Using this control we can execute the given code repeatedly
True : Timer will on (default)
False : Timer will off
♣ By default value is 60000 milliseconds
♣ Tick event is the default event of the timer control
♣ Tick event will execute for every given interval value
♣ For example if you assigned interval property as 1000 milliseconds, then tick event will execute for every 1000 milliseconds
♣ Drag and drop script manager control
♣ Drag and drop update panel control
♣ with in the update panel drag and drop two labels and one timer control like below
♣ Open properties windows, change the timer control interval property as 1000
♣ Double click on timer control and write the below code with in the Tick event.
Properties :
Enabled :
False : Timer will off
Interval :
Default Event :
♣ Tick event will execute for every given interval value
♣ For example if you assigned interval property as 1000 milliseconds, then tick event will execute for every 1000 milliseconds
Step 1 : Design of webform1.aspx
♣ Drag and drop update panel control
♣ with in the update panel drag and drop two labels and one timer control like below
♣ Open properties windows, change the timer control interval property as 1000
♣ Double click on timer control and write the below code with in the Tick event.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TimerControlExample
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TimerControlExample
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
}
}