Navigating to an anchor within a page

Discussion in 'ASP .Net' started by =?Utf-8?B?S2VuIFNsaWdodA==?=, Apr 7, 2006.

  1. Hello. Does anyone know how to navigate to a specific anchor within an ASPX
    page? For example, I have <a name='Test'>Hey there</a>, and I want to direct
    someone to that anchor in the PageLoad using code. In other words, if
    someone navigates to the default.aspx page, I want to immediately take them
    to the #Test anchor.

    Thanks,


    Ken
    =?Utf-8?B?S2VuIFNsaWdodA==?=, Apr 7, 2006
    #1
    1. Advertising

  2. In ASP.NET1.1 C# syntax, you can add in Page_Load:
    this.RegisterStartupScript ("navigateto","<script
    type='text/javascript'>document.location.href='#Test';</script>");


    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Ken Slight" wrote:

    > Hello. Does anyone know how to navigate to a specific anchor within an ASPX
    > page? For example, I have <a name='Test'>Hey there</a>, and I want to direct
    > someone to that anchor in the PageLoad using code. In other words, if
    > someone navigates to the default.aspx page, I want to immediately take them
    > to the #Test anchor.
    >
    > Thanks,
    >
    >
    > Ken
    >
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Apr 7, 2006
    #2
    1. Advertising

  3. Phillip,

    Thanks a ton. That was perfect.


    Ken


    "Phillip Williams" wrote:

    > In ASP.NET1.1 C# syntax, you can add in Page_Load:
    > this.RegisterStartupScript ("navigateto","<script
    > type='text/javascript'>document.location.href='#Test';</script>");
    >
    >
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "Ken Slight" wrote:
    >
    > > Hello. Does anyone know how to navigate to a specific anchor within an ASPX
    > > page? For example, I have <a name='Test'>Hey there</a>, and I want to direct
    > > someone to that anchor in the PageLoad using code. In other words, if
    > > someone navigates to the default.aspx page, I want to immediately take them
    > > to the #Test anchor.
    > >
    > > Thanks,
    > >
    > >
    > > Ken
    > >
    =?Utf-8?B?S2VuIFNsaWdodA==?=, Apr 7, 2006
    #3
  4. =?Utf-8?B?S2VuIFNsaWdodA==?=

    duneshade

    Joined:
    Apr 16, 2008
    Messages:
    1
    This does the trick better!!

    There is a function, the 'Server.Transfer("NewPage.aspx");' function or statement call it as you may. This transfers your viewrs from your current page to the NewPage. You can put this statemet anywhere you want. In Ken's case he should have put it in the Page_load() part of his code.
    duneshade, Apr 17, 2008
    #4
    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. Greg Krzeszkowski
    Replies:
    3
    Views:
    594
    Peter Blum
    Mar 3, 2005
  2. Samy
    Replies:
    0
    Views:
    531
  3. David C
    Replies:
    2
    Views:
    804
    Damon B.
    Aug 31, 2008
  4. Adrian
    Replies:
    3
    Views:
    110
    Adrian
    Nov 2, 2005
  5. Robert Mark Bram
    Replies:
    1
    Views:
    130
    GĂ©rard Talbot
    Nov 8, 2005
Loading...

Share This Page