move back to bottom of page after postback

K

Keith G Hicks

I have a fairly long page with a submit button, a validation summary and a
status label at the bottom of the page. I need it to go back to the bottom
after the post so that the user can see any status information.

I found some code that is supposed to do this but I cannot get it to work.
it compiles and runs but does not move me down to the bottom fo the page.
Here's my VB code that runs at the end of a sub where I post data back to
the database:

Dim Script As New StringBuilder()
Script.Append("<script language=JavaScript id='BookMarkScript'>
")
Script.Append("var hashValue='#BottomOfPage'; ")
Script.Append("if(location.hash!=hashValue) ")
Script.Append("location.hash=hashValue; ")
Script.Append("</script>")

If (Not
ClientScript.IsClientScriptBlockRegistered("BookMarkScript")) Then
ClientScript.RegisterClientScriptBlock(Me.GetType,
"BookMarkScript", Script.ToString())
End If

Here's the anchor that is near the bottom of the page:

<a name="#BottomOfPage"></a>


Can anyone tell me what I'm doing wrong?

Thanks,

Keith
 
K

Keith G Hicks

Thanks Mark. That did it. I also had to removee the # from the <a
name="#BottomOfPage"></a>
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top