Maintain scroll position after Postback is fired in ASP.Net C#

Maintain scroll position means After post back event fired the page position same as before.

There are many ways we can maintain scroll position after postback in


First Way: –

we can add below line on Page directive for a single page to maintain the previous scroll position when post back is fired.

<%@ Page MaintainScrollPositionOnPostback=”true” %>


Second Way:-

we can also write below code in code behind .aspx.cs file in ASP.Net

Page.MaintainScrollPositionOnPostBack = true;


Third Way : –

We can add below code in web.config file for set all page scroll position maintain.



<pages maintainScrollPositionOnPostBack=”true” />



Leave a Reply

Your email address will not be published. Required fields are marked *