positioning vertical scrollbar

  • Thread starter r pasadhy via .NET 247
  • Start date
R

r pasadhy via .NET 247

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
 
J

jagadeesh

Try to use SmartNavigation for the page
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
 
J

Joe Fallon

'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




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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top