Jquery Is Not Working In UpdatePanel

For More Videos Visit Our YouTube Channel


After page Load, the jquery events works well inside Updatepanel. After one postback, the Jquery events will not work inside Updatepanel. This is because, the Updatepanel will remove/replace the contents after postback. Hence the jquery cannot access the previous contents inside the Updatepanel.



This can be resolved by placing the previous contents inside Updatepanel after postback. There is a class named Sys.WebForms.PageRequestManager from Microsoft. This class manages the partial page updates of updatepanel controls in the browser. If there is updatepanel, an instance of the PageRequestManager class is automatically available. We can access PageRequestManager through getInstance method.

Jquery Is Not Working In UpdatePanel, jQuery $(document).ready and UpdatePanels, Jquery not working after postback in updatepanel, Updatepanel and Jquery,  Updatepanel VS Jquery, PageRequestManager In Updatepanel, Update Panel, Asp.Net

Add the code as shown in the above figure. The first section uses the PageRequestManager for updatepanel contents recovery. The jquery events that needs to be recovered should be included in this section. Here it is CallFunction which is included inside the method add_endRequest. The second section shows the document.ready which calls a function named CallFunction. Third section shows the function that is getting called on document.ready and PageRequestManager. By providing the above code, we can call jquery events after postback inside updatepanel.