Going back to the same location on page after postback or reload.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a page and if a user posts back data the page would open at the top.
This is not a problem if the user was looking at the content on the top of
the page , but if the page is long and the user was at the bottom of the page
then it looks ugly.

Is there a way IE can go back to the same location after postback or reload?

Thanks
 
To make a single page remember scroll position on postback, set the
MaintainScrollPositionOnPostback attribute in the @Page directive to True.

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

You can enable the feature for all pages in the site by setting it in the
<pages> element in Web.config.

<pages maintainScrollPositionOnPostBack="true" />
 
Thanks Peter,

I'l try that.


Peter Bromberg said:
To make a single page remember scroll position on postback, set the
MaintainScrollPositionOnPostback attribute in the @Page directive to True.

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

You can enable the feature for all pages in the site by setting it in the
<pages> element in Web.config.

<pages maintainScrollPositionOnPostBack="true" />


--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com
 
Sorry Peter,

But is this attribute available on .net 1.1 or is it just 2.0, cause I'm
using 1.1 and getting an error...

".....attribute is not supported by the 'page' directive"
 
Back
Top