For large web pages, you often want to maintain the user's current scroll position after a postback. To do that, use one of the following methods:
- In Web.config, in the <pages> section, add the Boolean attribute maintainScrollPositionOnPostBack="true". This will maintain the scroll positions for all the web site pages.
- In the page declaration, add <%@ Page MaintainScrollPositionOnPostback="true" %>. Doing so maintains the scroll position for that page only.
- From code behind, you can include System.Web.UI.Page.MaintainScrollPositionOnPostBack = true;. That's the equivalent of using the page declaration (it maintains the scroll position for only the altered page).