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: ,

Comments

# re: How to maintain the position of the scrollbar on postbacks with ASP.NET 2.0

Friday, February 08, 2008 2:46 PM by schnieds

Thanks for the tip Joe, I never realized that nice little property was available.

-Aaron

Leave a Comment

(required) 
(required) 
(optional)
(required)