[ACCEPTED]-ASP.NET - UpdatePanel and JavaScript-updatepanel
Yes:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
And then:
function endRequestHandler(sender, args)
{
// Do stuff
}
Documentation here and here. Keep in 2 mind that this will fire for every AJAX 1 request on the page.
This should do the trick:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args)
{
//Jquery Call
}
function EndRequestHandler(sender, args)
{
//Jquery Call
}
</script>
0
Here is an article for how to do it using 2 ScriptManager's static method RegisterClientScriptBlock. Tried 1 it and works like a charm.
http://csharperimage.jeremylikness.com/2009/06/inject-dynamic-javascript-into-aspnet.html
var requestManager = Sys.WebForms.PageRequestManager.getInstance();
requestManager.add_beginRequest(function () { alert('here1') });
requestManager.add_endRequest(function () { alert(here2') });
Source: http://www.howtositecore.com/?p=36
0
The Sys.WebForms.PageRequestManager.getInstance() method 7 works great for me as well.
I work with 6 a lot of pages that contain multiple Updatepanels 5 and I've learned that this will automatically 4 fire even if the Updatepanel you don't want 3 it for refreshes. So inside the function 2 that fires on the event make sure you have 1 something like:
function BeginRequestHandler(sender, args) {
if (args.get_postBackElement().id == "ID of the Updatepanel") {
// do stuff here
Bruno,
First, to answer your direct question. In 13 your callback that is being called by the 12 update panel, you should be able to use 11 a RegisterStartupScript call to invoke a 10 JS method . Then in your JS method, you 9 would show the message and then you can 8 use do a:
setTimeout('$('#myMessage').fadeOut("slow")', 4000);
to have it fade away after 4 seconds.
To 7 go one step further, since you're already 6 implementing JavaScript, I would invite 5 you to check out this article about UpdatePanels. If possible, I would 4 try to send Ajax calls to do your inserting, copying, and 3 editing and this would further simplify 2 your user feedback and would prevent excess 1 info across the wire.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.