tags:

views:

207

answers:

1

I have a page with an update panel and a timer. The page updates every 5 minutes based on the timer. I also have some javascript that forces a __doPostBack on the update panel if another page (launched from the original) is closed. The problem I think I'm having is sometimes the forced post back seems to interrupt the postback triggered by the timer which is creating errors. Is there a way to cancel the current postback and start another? or detect if a postback is under way? Should this even be a problem

+5  A: 

yes, you can cancel...

function CancelPostBack() {

var objMan = Sys.WebForms.PageRequestManager.getInstance();

if (objMan.get_isInAsyncPostBack())

    objMan.abortPostBack();

}

Reference URL
http://www.codedigest.com/Articles/ASPNETAJAX/125_Using_UpdateProgress_Control_Effectively.aspx

Muhammad Akhtar
You can prevent a new request in basically the same way, I believe. Just hook up the check to the beginRequest handler and return false if you detect that a request is already under way.
tvanfosson