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 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 &lt;pages /> entry of your <system.web /> section in your web.config file like so:

<pages maintainScrollPositionOnPostBack=”true”>

Bookmark and Share
blog comments powered by Disqus