How to jump to an anchor?

R

Robert Wehofer

Hello there!

How is it possible to jump to an anchor by using ASP.NET? Is it only
possible by using JavaScript Code? If so, how has the JavaScript to look
like?

Thank you in advance,
Robert
 
J

John Timney \(Microsoft MVP\)

Cant recall the exact syntax but you can invoke an anchor in the onload
event of the page. Should be soemthing like this.

body onLoad="window.location.hash='anchorname'

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
J

John Carnahan

This works for me..

Private Sub JumpToPage(ByVal cBookMark As String)

Dim script As String = "<SCRIPT
language='javascript'>location.href='#" & cBookMark & "'</SCRIPT>"

Page.RegisterStartupScript("startupscript", script)

End Sub
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top