Move/Scroll Page to Top After Asynchronous Postback in UpdatePanel in ASP.Net AJAX
Move/Scroll Page to Top After Asynchronous Postback in UpdatePanel in ASP.Net AJAX
Sometimes, we may require moving or scrolling the page to top after asynchronous postback caused in a lengthier page. We can do this with the help of PageRequestManager's end request event.
The below code can be used to do that.
<script type="text/javascript">
function pageLoad() {
var manager = Sys.WebForms.PageRequestManager.getInstance();
manager.add_endRequest(endRequest);
}
function endRequest(sender, args) {
window.scrollTo(0, 0);
}
</script>
|