Working with Asp.Net Timer control on client side

Hi,

 

Few days back I saw this question in the forums and from then I was looking for an answer for it.  The Timer control in the asp.net Ajax is pretty useful when we want to do some activity on the client side at a certain interval of time. The control also gives us good control on tweaking it on the server side. But Sometime the requirement is such that we want to change the value of timer interval, or stop the timer on the client side itself.

A few days back I learned that the timer control can easily be tweaked in the client side also. Let’s assume we are using a timer control with ID Timer1.

 

var Timer1 = $find(‘<%= Timer1.ClientID %>’);

 

//Now to change the timer interval use

Timer1.set_interval(5000); //To disable the timerTimer1.set_enabled(false); //To enable the timer againTimer1.set_enabled(true);


//And to stop the timer

Timer1._stopTimer();

 

Vikram

No Comments