Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

programatically scroll page to bottom?

Is there a way to scroll the page to the bottom (from a vb.net code-behind page)?

asp.net 2003

Thanks
0
ottenm
Asked:
ottenm
  • 2
1 Solution
 
ottenmAuthor Commented:
It's close, but it also scrolls horizontally a few pixels.  Anyone know how to keep the horizontal scroll flush against the margin?

More details (if needed):
My form uses flow layout which positions the controls a few pixels in from the left border of the browser.  The js does scroll to the bottom of the page, but it also scrolls to the right, a few pixels away from the margin to the left edge of the control.  I've tried to move the control further to the left (using CSS left and margin-left) but 1) it gets cut off and 2) the js still scrolls to the rights.

For convenience, here's the punchline from the (18 comment) sequence referenced above.  It will scroll your page to a particular control:

        Dim s As String = "<script language='javascript'>document.getElementById('" & _
            MyControlNearPageBottom.ClientID & "').scrollIntoView();</script>"
        Page.RegisterStartupScript("ScrollCode", s)

0
 
ottenmAuthor Commented:
Works for me, any complaints?

Page.RegisterStartupScript("ScrollCode", "<script language='javascript'>window.scroll(0,100000);</script>")
0
 
CetusMODCommented:
PAQed with points refunded (125)

CetusMOD
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now