Reputation: 25151
I have found out it is possible to execute javascript after an UpdatePanel has updated it's contents, but is it possible to execute javascript as soon as the trigger is fired?
I could probably hack some messy javascript, but I was wondering if ASP.NET had any 'inbuilt' functionality?
Upvotes: 1
Views: 207
Reputation: 7117
Quote from MSDN - endRequest Event:
The endRequest event is raised after an asynchronous postback is finished and control has been returned to the browser.
In other words you can attach a javascript handler function to the beginning and ending of a partial postback (when the update panel updates).
In the example on the page, you can see that the handler is attached using the PageRequestManager
:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler)
For reference purposes:
beginRequest - Start of the Request.
endRequest - When the request is completed.
Upvotes: 3
Reputation: 711
I guess there are a few options here you could obviously do something like the following.
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
But any of the page life cycle events could be used here is an excellent resource on what and when everything gets called.
Upvotes: 0
Reputation: 44605
UpdatePanel usage implies full page life cycle to be triggered again, so you should be able to catch the document ready, in jQuery terms, like this:
$(function() {
// Handler for .ready() called.
});
see here: http://api.jquery.com/ready/
Upvotes: 0