Friday, February 08, 2008 11:18 AM
Joe Levi
How to maintain the position of the scrollbar on postbacks with ASP.NET 2.0
In ASP.NET 1.1 it was a pain to maintain the position of the scrollbar when doing a postback operation.
In ASP.NET 2.0 and above you can simply add the MaintainScrollPostionOnPostBack attribute to the Page directive of any specific page:
<% Page Language=”C#” … MaintainScrollPositionOnPostback=”true” %>
If you would like to apply this behavior to your entire site simply
modify the <pages / > entry of your <system.web />
section in your web.config file like so:
<pages maintainScrollPositionOnPostBack="true">
You can thank me later.
- www.JoeLevi.com
Filed under: web.config, asp.net