I tried registering a javascript to scroll the window to co-ords 0,0 - which did not work.
If I made the page to always scroll to the top, then on EACH callback, the page would go right up - which is wrong again. So had to flag it and follow up and on a conditional basis.
For which I had to make the below code changes to get the page to scroll correctly:
Add the following to the markup:
<script language="javascript" type="text/javascript">
var errorEncountered;
errorEncountered = 0;
function scrollTop() {
if (errorEncountered == 1) {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(scrollTop2);
};
}
function scrollTop2() {
if (errorEncountered == 1) {
scrollTo(0, 0);
errorEncountered = 0;
};
}
</script>
Add the following to the code behind at the catch of an exception on save:
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Script", "errorEncountered=1;scrollTop();", True)
No comments:
Post a Comment