Last post Oct 13, 2008 04:58 PM by Kriswd40
Dec 16, 2005 12:47 AM|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 01:35 PM|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 10: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 04:58 PM|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.