positioning vertical scrollbar

Discussion in 'ASP .Net' started by r pasadhy via .NET 247, Aug 11, 2004.

  1. Hi,
    I am new to this list. So please forgive me if this question is arepeat.
    Basically, there is this big aspnet form on which I have a lot ofdropdown listboxes. When the selected index changes on any ofthese dropdowns, the form resubmits. The problem is that whenthis happens the user is forced to the top of the page and hasto scoll down to where they were at before the submit. This isunderstandably very annoying. How can I position the verticalscroll bar so that the page refresh takes the user back to wherethey were?
    Any help would be appreciated.
    Thanks in advance.
    R Pasadhy


    --------------------------------
    From: r pasadhy

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>vPRFeJTr5EKbV52MVtA/Sg==</Id>
    r pasadhy via .NET 247, Aug 11, 2004
    #1
    1. Advertising

  2. r pasadhy via .NET 247

    jagadeesh Guest

    Try to use SmartNavigation for the page
    "r pasadhy via .NET 247" <> wrote in message
    news:e%...
    Hi,
    I am new to this list. So please forgive me if this question is a repeat.
    Basically, there is this big aspnet form on which I have a lot of dropdown
    listboxes. When the selected index changes on any of these dropdowns, the
    form resubmits. The problem is that when this happens the user is forced to
    the top of the page and has to scoll down to where they were at before the
    submit. This is understandably very annoying. How can I position the
    vertical scroll bar so that the page refresh takes the user back to where
    they were?
    Any help would be appreciated.
    Thanks in advance.
    R Pasadhy


    --------------------------------
    From: r pasadhy

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>vPRFeJTr5EKbV52MVtA/Sg==</Id>
    jagadeesh, Aug 11, 2004
    #2
    1. Advertising

  3. r pasadhy via .NET 247

    Joe Fallon Guest

    'to remember scroll bar position so that postbacks restore the user to the
    spot on the page where they were:
    'any page that wants to use this feature needs to add this after the <form>
    tag:
    <input type="hidden" name="__SCROLLPOS" value="" />


    'I add this code to my base page in PreRender method so the attributes are
    added to the HTML Head tag whenever a form with that hidden field is posted.

    If Not (Request("__SCROLLPOS") Is Nothing) AndAlso
    Request("__SCROLLPOS") <> String.Empty Then
    Dim pos As Integer = Convert.ToInt32(Request("__SCROLLPOS"))
    .Attributes("onscroll") =
    "javascript:if(document.forms[0].__SCROLLPOS)document.forms[0].__SCROLLPOS.value
    = Body.scrollTop;"
    .Attributes("onload") = "javascript:Body.scrollTop=" & pos & ";"
    Else
    .Attributes("onscroll") =
    "javascript:if(document.forms[0].__SCROLLPOS)document.forms[0].__SCROLLPOS.value
    = Body.scrollTop;"
    End If

    --
    Joe Fallon




    "r pasadhy via .NET 247" <> wrote in message
    news:e%...
    Hi,
    I am new to this list. So please forgive me if this question is a repeat.
    Basically, there is this big aspnet form on which I have a lot of dropdown
    listboxes. When the selected index changes on any of these dropdowns, the
    form resubmits. The problem is that when this happens the user is forced to
    the top of the page and has to scoll down to where they were at before the
    submit. This is understandably very annoying. How can I position the
    vertical scroll bar so that the page refresh takes the user back to where
    they were?
    Any help would be appreciated.
    Thanks in advance.
    R Pasadhy


    --------------------------------
    From: r pasadhy

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>vPRFeJTr5EKbV52MVtA/Sg==</Id>
    Joe Fallon, Aug 12, 2004
    #3
    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. Olav Tollefsen
    Replies:
    1
    Views:
    40,703
    Ken Cox [Microsoft MVP]
    Jan 29, 2005
  2. SJ
    Replies:
    1
    Views:
    1,627
    Kevin Spencer
    Jan 11, 2006
  3. Don Schneider
    Replies:
    0
    Views:
    2,010
    Don Schneider
    Jun 27, 2003
  4. Sean
    Replies:
    2
    Views:
    437
    Toby A Inkster
    Aug 7, 2003
  5. Z
    Replies:
    2
    Views:
    5,311
Loading...

Share This Page