Scrolling to the top of the page after ASP.Net Ajax Async-Postback without jQuery

I need to scroll up after Async Postback in the update panel. I tried several methods, and while they all scroll to the top of the page, they all get "overriden" from ASP.Net Ajax, which returns the page to where it was when the postback occurs. I already set MaintainScrollPositionOnPostBack = "false" in the page directive.

+3
source share
1 answer

Have you tried window.scrollTo (0, 0);

If you have, maybe compatible with setTimeout

window.setTimeout("window.scrollTo(0, 0)", 3000);

Although I expect this to lead to some ugly jumps.

EndRequest

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
    window.scrollTo(0, 0);
} 
+3

Source: https://habr.com/ru/post/1746405/


All Articles