Short post, long title. Here is a simple jQuery plugin that makes it a little easier to add an begin/end request handler to the PageRequestManager on an ASP.NET web form.
(function ($, undefined) {
$.registerAsyncBegin = function(callback) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm) {
prm.add_beginRequest(callback);
}
return callback;
};
$.registerAsyncEnd = function(callback) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm) {
prm.add_endRequest(callback);
}
return callback;
};
})(jQuery);
This example adds a function to be executed after ever Update Panel request and runs the function. This is useful if you have a function that needs to do some initial processing as well as after a request.
($.registerAsyncEnd(SomeCallbackFunction))();
No comments:
Post a Comment