Using PageRequestManager
Listing 2. The PageRequestManager class is in the Sys.WebForms namespace. It can be accessed by calling a static/shared method named getInstance(). Sys.Application.add_init(Init); var intervalID = null; function Init(sender) { var prm = Sys.WebForms.PageRequestManager.getInstance(); //Ensure EnablePartialRendering isn't false which will prevent //accessing an instance of the PageRequestManager if (prm) { if (!prm.get_isInAsyncPostBack()) { prm.add_beginRequest(BeginRequest); prm.add_endRequest(EndRequest); } } } |