Maintain ScrollBar position on postbacks in ASP.NET Page

After user clicks on postback controls, ASP.NET web page is reloaded in the browser and scroll position is set to the top of the page.

If your pages are high/long and controls that cause postback are placed on the bottom it can be really annoying for users to manually scroll down after every postback.

Fortunately, this can be easily solved using the Page.MaintainScrollPositionOnPostBack property like this:

<%@ Page Language="C#" AutoEventWireup="true" ... MaintainScrollPositionOnPostback="true" %>


After the postback and reload of the page, the previous scroll position will be restored.

NOTE: This only works in .Net Framework 2.0 and higher!
Ebook Download
View all
Learn
View all