I did 2 things to make the warnings work.
1) I changed the warning script to this
<script type="text/javascript">
<!--
var warnMessage = "You have entered new data on this page. If you navigate away from this page without first saving your data, the changes will not be saved. To save your data, click the Cancel button, then save your data before leaving this page.";
var g_isPostBack = false;
function windowOnBeforeUnload() {
if (g_isPostBack == true)
return;
if (window.event)
window.event.returnValue = warnMessage;
else
return warnMessage;
}
2) I added a updatepanel to the page.
0 points awarded.
window.onbeforeunload = windowOnBeforeUnload;