Navigating to an anchor within a page

G

Guest

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
 
G

Guest

In ASP.NET1.1 C# syntax, you can add in Page_Load:
this.RegisterStartupScript ("navigateto","<script
type='text/javascript'>document.location.href='#Test';</script>");
 
Joined
Apr 16, 2008
Messages
1
Reaction score
0
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.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,081
Latest member
AnyaMerry

Latest Threads

Top