Javascript event for Atlas page load

  • Thread starter Thread starter Surya Vellanki
  • Start date Start date
S

Surya Vellanki

Hi all,

I have been struggling with this problem from a few days. I hope I
will get some help here.

I am developing an online quiz portal with ASP.NET 2.0 and I am using
Atlas framework for rich UI.

I was in need of a timer control which keeps track of the quiz time
and sends a post back when the time expires!
For this purpose I am using Cronometro control by Manuel Abadia in
Code Project (http://www.codeproject.com/aspnet/dhtml_timer.asp)

Now the issue is that when there is an AJAX postback I want the timer
to pause till the page reloads. I could pause this timer with
javascript but I dont see any way to unpause it when the page loads
back because it is an AJAX page load and I dont know if there is a way
to run javascript in this event.

Could some one tell me if there is a way to run javascript on AJAX
page reloads?
Another solution could be to use a different timer control which
automatically pauses on AJAX calls. If anyone knows of such a control
could you share with me?

I know I can do this without using AJAX/Atlas at all but I am trying
if I could

Thanks in advance
 
After an ASP.NET AJAX asynchronous postback you could use the Page Request
Manager's EndRequestHandler event to restart your timer.

So something along these lines should do it:

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
restartTimer();
}
 
Back
Top