[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

When page loads, How can I go to the bottom of the page?

Posted on 2004-10-27
6
Medium Priority
?
1,487 Views
Last Modified: 2011-10-03
Every time I do a postback my page goes back to the top of the page.  My users have to keep scrolling down.  I have turned on Smart Navagation on my page but that has no effect.  Not sure why either.  My form pulls in alot of user controls.  On each post back it adds another user control to the bottom of the web form.  Thats the control I would want to have focus for lack of a better name.

Anyone got a suggestion on either how to set focus to a paticular User Control or how to make the page go to the bottom when it loads?

Thanks for your time!!!
0
Comment
Question by:accmats
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:onura
ID: 12422261
Hi,

Put an anchor to the bottom of your page,
<a name="bottom">
and call your page with #bottom at the end.
During the postbacks it should go to bottom anchor.

This might work.
0
 

Author Comment

by:accmats
ID: 12422421
what would be the syntax of that #Bottom and would I put that in the page load event?
0
 

Expert Comment

by:onura
ID: 12422488
no, just put after the adress on the link like http://www.nowhere.com/page.aspx#start1
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:YZlat
ID: 12422812
just use this javascript function:

function scrollToCoordinates() {
      window.scrollTo(0,800)
      
}

call it from body onLoad :

<body onload="javascript:scrollToCoordinates()" MS_POSITIONING="FlowLayout">
0
 
LVL 33

Expert Comment

by:raterus
ID: 12422813
nooo, don't use anchors!  You get the double-click effect when the page loads.  Use Javascript and the ScrollIntoView() function.

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/scrollintoview.asp
0
 
LVL 35

Accepted Solution

by:
YZlat earned 1000 total points
ID: 12422854
add two hidden fields to the page, call then scrollx and scrolly. Then add the following javascript code:

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
document.Form1.scrollx.value = tempX;
document.Form1.scrolly.value = tempY;

return true;
}
function scrollToCoordinates() {
      //alert(document.Form1.scrollx.value);
      //alert(document.Form1.scrolly.value);
      window.scrollTo(document.Form1.scrollx.value-50,document.Form1.scrolly.value-50)
      
}

Then call scrollToCoordinates from body onLoad:

<body onload="javascript:scrollToCoordinates()" MS_POSITIONING="FlowLayout">
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question