Monday, June 02, 2014

ASP. Net site with many Update Panels?

So you have an ASP. Net site with many Ajax Update Panels? The problem : trying to do client side javascript interactions when the page keeps posting back partial. The scripts need to run after the partial page returns, so they are not overridden by the back end.
The solution:
Capture the page upon return with the following:
            var sysApplication = Sys.WebForms.PageRequestManager.getInstance();
            sysApplication.add_initializeRequest(beginRequest);
            sysApplication.add_endRequest(endRequest);
 
            function beginRequest() {
               // document.getElementById("divMessage").style.display = "inline";
              
            }
 
            function endRequest() {
                setWizardProgress();
            }