jQuery calls and Ajax UpdatePanel

Hi, guyz.

In many cases I have found that jQuery code blocks do not work when update panel is there and auto postback does occur.

So in that case here is the solution, just put down below snippet inside script block at end of the page. Note that put your script where I have written bind your jQuery events/calls here initially. And the same you need to register in one ajax event add_endRequest. You can create function here for re-usability instead of writting it two times.!

$(document).ready(function() {
    // bind your jQuery events/calls here initially
});

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function() {
    // re-bind your jQuery events here
});

Cheers!

Advertisements

One thought on “jQuery calls and Ajax UpdatePanel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s