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

Discussion in 'ASP .Net' started by =?Utf-8?B?bWF2cmlja18xMDE=?=, Aug 8, 2007.

  1. 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
     
    =?Utf-8?B?bWF2cmlja18xMDE=?=, Aug 8, 2007
    #1
    1. Advertising

  2. 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



    "mavrick_101" wrote:

    > 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
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Aug 9, 2007
    #2
    1. Advertising

  3. RE: Going back to the same location on page after postback or relo

    Thanks Peter,

    I'l try that.


    "Peter Bromberg [C# MVP]" wrote:

    > 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
    >
    >
    >
    > "mavrick_101" wrote:
    >
    > > 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
     
    =?Utf-8?B?bWF2cmlja18xMDE=?=, Aug 9, 2007
    #3
  4. RE: Going back to the same location on page after postback or relo

    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"






    "Peter Bromberg [C# MVP]" wrote:

    > 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
    >
    >
    >
    > "mavrick_101" wrote:
    >
    > > 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
     
    =?Utf-8?B?bWF2cmlja18xMDE=?=, Aug 9, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    12
    Views:
    4,779
    tshad
    Nov 2, 2004
  2. nvv via DotNetMonster.com

    avoid a page going back to site after logging out

    nvv via DotNetMonster.com, Jan 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    601
    Maheeja Swarna via DotNetMonster.com
    Jan 27, 2005
  3. =?Utf-8?B?TG91aXMtUGhpbGlwcGUgRHVtb3VsaW4=?=

    ajax postback causing Page reload after normal events life cycle

    =?Utf-8?B?TG91aXMtUGhpbGlwcGUgRHVtb3VsaW4=?=, Mar 14, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,348
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Mar 14, 2006
  4. Joshua Beall
    Replies:
    26
    Views:
    220,682
    AndreiKaa
    Jun 29, 2007
  5. js
    Replies:
    0
    Views:
    174
Loading...

Share This Page