Last post Oct 13, 2008 11:58 AM by Kriswd40
Dec 15, 2005 07:47 PM|smeeg|LINK
This event is fired once when the user clicks on links, postback buttons or closes the window - which is perfect.
However when clicking on a Treeview node the event is fired twice - so to proceed the user has to confirm that they don't want to save their changes twice.
Does anyone know why/how the treeview is doing this and a possible way around it?
Here is the Treeview code:
Dec 16, 2005 08:35 AM|smeeg|LINK
I've fixed that with a setTimeout:
var checkChangesEnabled =
window.onbeforeunload = confirmExit;
The next problem to sort out is stopping the treeview firing onbeforeunload when the user expands a node... Again, any thoughts would be more than welcome!
May 24, 2007 05:14 PM|ninabai|LINK
I just found this post after struggling with this problem on a LinkButton. It's simple and works great! Thank you so much! Very clever way to work around this problem.
Oct 13, 2008 11:58 AM|Kriswd40|LINK
Just found this too and using it to get around the same problem with a gridview that is inside an update panel.
Anyone know why this event gets fired twice in the first place? It seems like it's a bug we're working around with this code, not a desired feature.