Thursday, December 20, 2007

How to maintain the position of the scrollbar on postbacks

In ASP.NET 1.1 it was a pain to maintain the position of the scrollbar when doing a postback operation. This was especially true when you had a grid on the page and went to edit a specific row. Instead of staying on the desired row, the page would reload and you'd be placed back at the top and have to scroll down. In ASP.NET 2.0 you can simply add the MaintainScrollPostionOnPostBack attribute to the Page directive:

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


if we want this functionality in entire site then use this...
modify the entry of the section with this...

<
pages maintainScrollPositionOnPostBack="true" />

No comments: