Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops. Juri is also a recognized Google Developer Expert in Web Technologies

HowTo: Launch JavaScript after async postback of UpdatePanel

1 min read

Assume the scenario where you want to launch a JavaScript function after your UpdatePanel finished to do its async postback. This turns out to actually be quite simple. What you do is to use the ScriptManager.RegisterStartupScript(...) method.
ScriptManager.RegisterStartupScript(btnSave, this.GetType(), "myScriptKey", "myFunction()", true);
The only thing I found that people misdo is to not specify the correct instance (1st parameter) that caused the asynchronous postback to fire and thus the UpdatePanel to do the postback. In such a case it will just fail silently.
Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus