How to setup your Javascript/JQuery code with AJAX mode enabled

AJAX type web forms perform partial page updates made by an UpdatePanel on the page.
Code like $(document).ready(function(){}); will only be executed once after the page Document Object Model (DOM) is ready for JavaScript code to execute.

If you want to execute JavaScript code after each partial update, use the MSAjax pageLoad Event in your Javascript code:


           // To ensure JavaScript is executed in runtime mode only.
            if (typeof $selectedObject === "undefined") 
               ///  This will fire on initial page load, 
               ///  and all subsequent partial page updates made 
               ///  by any update panel on the page
                function pageLoad(){ alert('page loaded!')}