Re: When resubmitting a long page, how do you preserve the vertical position on the page?
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 09/04/04
- Next message: Laphan: "ASP ecommerce help"
- Previous message: Evertjan.: "Re: When resubmitting a long page, how do you preserve the vertical position on the page?"
- In reply to: Mike: "When resubmitting a long page, how do you preserve the vertical position on the page?"
- Next in thread: Steven Scaife: "Re: When resubmitting a long page, how do you preserve the vertical position on the page?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 4 Sep 2004 08:29:50 -0400
Mike wrote:
> Hello,
>
> I've got a long page that resubmits itself to pass variable settings
> like this:
>
> http://localhost/hwlist2.asp?user=Kithmaker&user2=&sortby=cNumber
>
> the problem is that when the page reloads the user starts at the top
> again. Is there any way of preserving the vertical position the user
> is viewing on the page?
>
> Thanks,
> Mike
This is mostly a client-side coding question. Let me address the small
portion that will be asp-related:
Is it long due to lengthy text? Or is it long due to many controls on the
page? If the latter, you can add a hiiden textbox to the page and use
client-side code in the onsubmit event to populate that textbox with the
name of the control that curently has focus. Then your server-side code can
pass that id back to the winow_onload event:
<%
dim sActiveControlID
sActiveControl = Request.Form("txtActiveControlID")
'substitute Querystring for Form if using Get
...
%>
<html>
<head>
<script language=javascript>
function window_onload() {
var sActiveID = "<%=sActiveControlID%>"
where the focus() method can be used in conjunction with the
getElementByID() method to set focus to to that control. You may also need
to use the scrollIIntoView() method to cause it to scroll into view:
var obj=document.getElementByID(sActiveID)
obj.focus()
obj.scrollIntoView()
...
For more detail, see one of the scripting groups, or one of the groups with
"dhtml" in their name. The abopve is air code and I did not bother looking
up the proper syntax or spelling of the methods used in the client-code
section. The DHTML documentation (as well as the documentation for all MS
technologies) can be found here: http://msdn.microsoft.com/library. Drill
down in the menu starting at Web Development down to HTML and Dynamic HTML.
HTH,
Bob Barrows
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
- Next message: Laphan: "ASP ecommerce help"
- Previous message: Evertjan.: "Re: When resubmitting a long page, how do you preserve the vertical position on the page?"
- In reply to: Mike: "When resubmitting a long page, how do you preserve the vertical position on the page?"
- Next in thread: Steven Scaife: "Re: When resubmitting a long page, how do you preserve the vertical position on the page?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|