Monday, June 11, 2012

ASP.NET Update Panel not reloading jquery

Issue: asp.net update panel not reloading custom jquery after a partial post back occurs.

Cause: The asp.net update panel reloads all the content within the content template tags, thus your custom jquery is not reloaded and never fired.

Solution: Add your custom jquery at the end of the request by using the page request manager object:

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

    prm.add_endRequest(function () {
        DOSTUFF();
    });

And problem solved, it's as easy as that.

I hope this helped you, it solved my problem.