I am having a few problems with the Timer component in ASP.NET. I can get it to work in the C# part of visual studio but not in the ASP.NET.
The thing is a number will be logged into the website so each person will need to view the same timer counting down to zero. I guess this rules out putting it in the html??
This is the code in ASP.NET. The timer1_Elapsed method is not being called though all sources tell met this is how it works.
protected System.Timers.Timer timer1;
private int test;
protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
test = 1;
timer1.Interval = 1000;
timer1.Start();
timer1.Enabled = true;
}
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
test = test+1;
lblCounter.Text = "count:"+test;
}
In C# the 'timer1.enabled' method calls the 'timer1_Tick' which, as far as i know, is the same as the Elapsed method above.
Many thanks!!!!