Use jquery when Partial page update

When you are using jquery with ajax make sure you load jquery when partial page update. Normal page postback and page load method you can  load jquery plugin using

 $(document).ready(function() {
    // put all your jQuery goodness in here.
});

But this method will not fire when ajax call either partial page update or ajax call back
 if you are using asp.net ajax framework you can use the following code snep to load jquery

Sys.WebForms.PageRequestManager.getInstance().add_EndRequest(Request_End);
     function Request_End(sender, args)
     {
          // Insert code you want to occur after partial page load here
     }


 If you are using jQuery to send the request, then you can either set a call back using the load function. 

$(".ajaxLink").load(url, null, function() {   
// put all your jQuery goodness in here. 
});

or set a global ajaxComplete event that is fired every time an ajax call is complete.
$(document).ajaxComplete(function() { 
// put all your jQuery goodness in here. 
});

Comments

Popular posts from this blog

GROUP BY, CUBE, ROLLUP and SQL SERVER 2005

How to get content of Ckeditor & Fckeditor using Javascript

How to Fix Error- Sys.WebForms.PageRequestManagerTimeoutException - The server request timed out