Friday, July 10, 2009

maintain scrollposition after post back?

By default a web page will be returned to the top of the page, after a postback. What if you want to take back to the position where user was before the postback , it's simple. You can do one of the followings.

1.For the whole website
In the web.config add the attribute to the pages node.
<"pages maintainScrollPositionOnPostBack="true">

2. Particular page,
In the HTML (.ASPX)

< %@ Page Language="C#" MaintainScrollPositionOnPostback = "true"


and you can set this in

3.CODE (ASPX.SC)
Page.MaintainScrollPositionOnPostBack = true;

That's all you have to do. You will be back to where you were.

0 comments:

My Achievements

Member of

Blog Archive

Followers