How to jump to an anchor?

Discussion in 'ASP .Net' started by Robert Wehofer, Nov 13, 2003.

  1. 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
     
    Robert Wehofer, Nov 13, 2003
    #1
    1. Advertising

  2. 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>
    ----------------------------------------------

    "Robert Wehofer" <> wrote in message
    news:DuOsb.31380$...
    > 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
    >
    >
     
    John Timney \(Microsoft MVP\), Nov 13, 2003
    #2
    1. Advertising

  3. 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
     
    John Carnahan, Nov 17, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    16
    Views:
    13,415
    darrel
    Feb 8, 2005
  2. Aaron Freeman
    Replies:
    7
    Views:
    1,752
    Jonathan N. Little
    Mar 17, 2006
  3. Robert Mark Bram

    Jump to named anchor after form processing

    Robert Mark Bram, Oct 20, 2004, in forum: ASP General
    Replies:
    3
    Views:
    197
    Evertjan.
    Oct 21, 2004
  4. TWW
    Replies:
    1
    Views:
    140
    A. Sinan Unur
    Jul 16, 2003
  5. Eadwine Rose
    Replies:
    2
    Views:
    215
    Eadwine Rose
    Oct 15, 2006
Loading...

Share This Page