Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping and starting a Timer in ASP.NET Ajax

Tags:

asp.net-ajax

If you have an ASP.NET UpdatePanel and and ASP.NET Timer that trigers theUpdatePanel to refresh, is it posible, in javascript, to stop/pause the timer?

I want to stop the timer when the users mouse is over the updatepanel!

like image 348
MrHinsh - Martin Hinshelwood Avatar asked Dec 10 '22 21:12

MrHinsh - Martin Hinshelwood


2 Answers

The best way is to use enabled property for the timer control

timer1.Enabled = false; //For stop the timer

timer1.Enabled = true; // For starting the timer
like image 75
Mjunaid Avatar answered Apr 17 '23 17:04

Mjunaid


http://forums.asp.net/t/1094798.aspx

then just attach a client side event to the updatepanel ala -

http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/ - but change to onmouseover to call them.

like image 24
Squiggs. Avatar answered Apr 17 '23 16:04

Squiggs.