Hi,
The root of the problem is onbeforeunload is fired whenever a HTML link is clicked. For example, onbeforeunload is fired when the following link is clicked:
Code: HTML/ASPX
<a href="AnotherPage.aspx">leave current page and go to another page</a>
However it is also fired when the following link is clicked:
Code: HTML/ASPX
<a href="javascript:SayHello();">Say Hello!</a>
The problem is not particular to our Grid but to all HTML links. For example, you will see the same problem with a standard ASP.NET LinkButton control.
There is no "official" solution for this problem as we are aware of. One way is to scan all A elements in your page and track their onclick event, based on the assumption that onclick event is fired shortly before onbeforeunload event. You will then set a flag in your onclick handler to mark a link has just been clicked and check that flag in your onbeforeunload handler to identify whether it is really a link that tries to navigate away. If it is not, then you skip your normal unbeforeunload logic. However not only this is quite some extra work, but our experience also indicates that it does not always work reliably.
Thanks!