By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,054 Members | 1,635 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,054 IT Pros & Developers. It's quick & easy.

Navigating to a bookmark on page?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
Alex,
Thanks alot...
worked perfectly!
John
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.