Friday, April 11, 2008

Javascript onUnload and postback

So I just ran into an interesting scenario. I have a custom control where I need an event to fire before postback but I don't want to have to add an OnClientClick event in every page that uses the control. In fiddling with the javascript onunload event I found that oddly enough the unload event fires after postback to my aspx page. The solution? Use onbeforeunload instead:

window.onbeforeunload = unload;

function unload() {

No comments:

Post a Comment