Here is the code to move to anchor after postback
<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(OnEndRequest);
function OnEndRequest(sender,args)
{
window.location.hash = '#MOVEHERE'; //MOVEHERE is the anchor name
}
</script>
If you want to show top of the page instead of move to anchor use window.scrollTo(0,0); instead of window.location.hash = '#MOVEHERE';
<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(OnEndRequest);
function OnEndRequest(sender,args)
{
window.location.hash = '#MOVEHERE'; //MOVEHERE is the anchor name
}
</script>
If you want to show top of the page instead of move to anchor use window.scrollTo(0,0); instead of window.location.hash = '#MOVEHERE';
Comments