07 July 2008
How To Scroll To Top Of Page On An AJAX Postback [ASP.NET]
Scrolling to top of the page on an Ajax request in ASP.NET page is quite tricky. The regular inline anchor techniques does not work. We need to handle the endRequest event and scroll the window to 0,0 coordinates(top of the page).
Here is the sample code that can be pasted on your aspx page to scroll an ASP.NET page to top on every Ajax postback operation.
<script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestEventHandler); function EndRequestEventHandler(sender, args) { scrollTo(0,0) } </script>
Loading
Simillar Posts
- How To Perform Client Side Action After Completion Of AJAX Postback Operation[ASP.NET 2.0]
- How To Identify Language of Any Text
- Flip Text, Free Windows 7 Wallpaper, Tech Dreams Mobile Edition, Automatically Switch Wallpapers [Recap]
- How To Display Indian Rupee Symbol On Your Blog Or Web Site
- 8 Things To Do With Mouse Scroll Wheel In Firefox

March 30th, 2009
Great tip!
July 29th, 2009
Brilliant! I’ve been looking everywhere for something like this, though now I’m not sure I want it to happen on every request, but so far it works great.
November 6th, 2009
Thanks buddy.
Its a great tip which i was searching a long time and left as i didn get any idea.
good work.
God bless
February 2nd, 2010
Thanks mate. It was wonderful