468,771 Members | 1,692 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,771 developers. It's quick & easy.

Navigating to a bookmark on page?

How would I accomplish the following ?
Navigate to a bookmark on a page from a routine in the code behind.

---- html code

bookmark1 (someplace on the page... is this an htmlanchor?)
?? how do I define the bookmark??

bookmark2 (somwhere else down the page)

-----

--- Code behind file

Sub GotoBookmark(byVal myBookmark As String)
' what goes here ??
?? NavigateToBookmark(myBookMark) ????
End Sub
Nov 17 '05 #1
3 3604
I don't think it's doable on the server side. I just do a Redirect to the
same page, and put the anchor in the URL,

http://mysite/mywebform.aspx#anchorname

"John Carnahan" <ca********@msn.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
How would I accomplish the following ?
Navigate to a bookmark on a page from a routine in the code behind.

---- html code

bookmark1 (someplace on the page... is this an htmlanchor?)
?? how do I define the bookmark??

bookmark2 (somwhere else down the page)

-----

--- Code behind file

Sub GotoBookmark(byVal myBookmark As String)
' what goes here ??
?? NavigateToBookmark(myBookMark) ????
End Sub

Nov 17 '05 #2
Hi
this can be done. The html bookmark code is of the form
<A name='#bookmark1'></A>"
The server code that causes the browser to jump to it is
a script function that runs when the page loads
string script = "<SCRIPT
language='javascript'>location.href='#bookmark';</SCRIPT>"
;
Page.RegisterStartupScript("startupscript",script) ;

alex
-----Original Message-----
How would I accomplish the following ?
Navigate to a bookmark on a page from a routine in the code behind.
---- html code

bookmark1 (someplace on the page... is this an htmlanchor?) ?? how do I define the bookmark??

bookmark2 (somwhere else down the page)

-----

--- Code behind file

Sub GotoBookmark(byVal myBookmark As String)
' what goes here ??
?? NavigateToBookmark (myBookMark) ???? End Sub
.

Nov 17 '05 #3
Alex,
Thanks alot...
worked perfectly!
John
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Adrian | last post: by
6 posts views Thread by Chris | last post: by
2 posts views Thread by Tom | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.