Howto Scroll to bottom of webform - after button click ??

Hi folks,

I have a webform (, with a button at the bottom, once the user click the button I want to verify his/her input and print our his/her selection at the bottom and then change the button from verify to submit...

Everything is working fine... , except for the "auto scroll to the bottom" part... so I do a postback currently on the button click and verify a few things server side... however when it comes back I want to scroll to the bottom of my webform...

How would I do this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raju SrivatsavayeSoftware EngineerCommented:
I have a javascript that might work just fine for you:Here it is:

function scroll()
      var coll = document.all.tags("P")
      col1(id).bAlignTop = false----Here try using .bAlignBottom=true

Just enter the id here and call this in the button click: You should be calling this javascript this way:

 Dim strScript As String = "<script language=JavaScript>"
                strScript += "Scroll();"
                strScript += "</script>"
                If (Not Page.ClientScript.IsStartupScriptRegistered("clientScript")) Then
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strScript)
                End If
Raju SrivatsavayeSoftware EngineerCommented:
Hey modify the javascript like this:

var coll=document.getelementbyid("button1")

      coli.bAlignBottom = true
newbreedccAuthor Commented:
Okay tried it... I'm having problems with your :  "Page.ClientScript" it's a member of what ???
I'm using .net framework 1.1

Do I need to "Imports" anything first ?
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Raju SrivatsavayeSoftware EngineerCommented:
thats for 2.0
Raju SrivatsavayeSoftware EngineerCommented:
try removing the ClientScript
newbreedccAuthor Commented:
Nope, still not working... thanks for trying anyway
Raju SrivatsavayeSoftware EngineerCommented:
try this for last time:

If (Not Page.ClientScript.IsStartupScriptRegistered("clientScript")) Then
                    Page.ClientScript.RegisterStartupScript("clientScript", strScript)
                End If
Raju SrivatsavayeSoftware EngineerCommented:
I mean this

If (Not Page.IsStartupScriptRegistered("clientScript")) Then
                    Page.RegisterStartupScript( "clientScript", strScript)
                End If
newbreedccAuthor Commented:
Still don't get it working...

By the way I changed your js function to this:

            function scroll() {
                  var coll=document.getelementbyid("btnSubmit");
                                  coll.bAlignBottom = true;
Raju SrivatsavayeSoftware EngineerCommented:
Lets try our javascript lil differently

 function scroll()
      var coll = document.all.tags("asp")
      coll(btnSubmit).bAlignToBottom = true
newbreedccAuthor Commented:
Dude, are you just randomly guessing or are you actually trying to help ??

It's still not working.. thanks for trying

Raju SrivatsavayeSoftware EngineerCommented:
Thats a good question...I actually did this for navigating to a particular text on the page.its working well for me
Do you absolutely need to scroll to the bottom, or would scrolling to a particular control on the page suffice?
newbreedccAuthor Commented:
A particular control would be good enough..

untested, but should work,
Page.RegisterStartupScript("MyScrollingStuff", "<script language='javascript'>document.getElementById('" & myControl.ClientID & "').scrollIntoView();</script>")

replace "myControl" with a reference to whatever control you want to scroll to when the page loads.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
newbreedccAuthor Commented:
awesome raterus! thanks..
newbreedccAuthor Commented:
I simply used :

If IsPostBack Then
            Page.RegisterStartupScript("MyScrollingStuff", "<script language='javascript'>document.getElementById('" & btnSubmit.ClientID & "').scrollIntoView();</script>")
End If
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.