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