> Can anyone tell me what I'm doing wrong?
You're using RegisterClientScriptBlock.
This places the JavaScript at the beginning of the webform i.e. just after
the opening <form> tag. This means that (almost certainly) the rest of the
form including the anchor tag hasn't been created when the script tries to
run.
Use RegisterStartUpScript instead, as this places the JavaScript at the end
of the webform i.e. just before the closing </form> tag.
Also, there's no need to include the <script> and </script> tags explicitly,
as ASP.NET will do this for you, e.g.
Dim Script As New StringBuilder()
Script.Append("var hashValue='#BottomOfPage';")
Script.Append("if(location.hash!=hashValue)")
Script.Append("location.hash=hashValue;")
If (Not ClientScript.IsClientScriptBlockRegistered("BookMarkScript")) Then
ClientScript.RegisterStartUpScript (GetType(), "BookMarkScript",
Script.ToString(), True)
End If

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Keith G Hicks - 15 Apr 2008 14:48 GMT
Thanks Mark. That did it. I also had to removee the # from the <a
name="#BottomOfPage"></a>
> > Can anyone tell me what I'm doing wrong?
>
[quoted text clipped - 25 lines]
> ASP.NET MVP
> http://www.markrae.net