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

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

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

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,783
    darrel
    Feb 8, 2005
  2. Aaron Freeman
    Replies:
    7
    Views:
    1,967
    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:
    345
    Evertjan.
    Oct 21, 2004
  4. TWW
    Replies:
    1
    Views:
    224
    A. Sinan Unur
    Jul 16, 2003
  5. Daniel Goldman

    new popup window does not jump to anchor

    Daniel Goldman, Sep 20, 2003, in forum: Javascript
    Replies:
    1
    Views:
    157
    Richard Cornford
    Sep 20, 2003
  6. Rob

    jump to an anchor/bookmark

    Rob, Jul 30, 2004, in forum: Javascript
    Replies:
    2
    Views:
    143
  7. Eadwine Rose
    Replies:
    2
    Views:
    361
    Eadwine Rose
    Oct 15, 2006
  8. Bjorn Nordbo

    jump to anchor w/o breaking history

    Bjorn Nordbo, Jan 11, 2007, in forum: Javascript
    Replies:
    2
    Views:
    164
    Bjorn Nordbo
    Jan 12, 2007
Loading...