Anchor name problem (#)

D

Dan Tanzer

I have a page that has two user controls header and body.
In the header control I set a hyperlink navigateURL = #somesection
in my usercontrol body I have anchor tag called id=somesection.

I must be missing something but how do I get the hyperlink to move to the
somesection on my page?

Set up:
the path to the page is \page.aspx
the controls are in \controls\header.ascx and \controls\body.ascx.

I will also have a querystring to contend with, something like
?id=1#somesection.

Please help, this seemed so simple till I couldn't get it to work.
thanks in advance
Dan
 
D

Dan Tanzer

I wish it was that simple. if you do that from a header control the paths
thinks it is
mysite\control\#target.
 
Y

Yama

I don't understand!

Okay so why don't you build the URL dynamically within the code behind?

In you header.ascx I will have:
<a HREF="default.aspx#target"> Navgate There </a>

in your body.ascx
Lot of words.....
Somewhere in body
<a NAME="target">Come here</a>

This doesn't work? It works fine with me...

Yama
 
D

Dan Tanzer

can you combine a querystring and an name anchor? because i was able to
modify the code to display the intended link but it doesnt move to the
target.
 
Y

Yama

THe problem with the query string is that it will not recognize the anchor
tag... Replace it with something like a "-" dash then when moving to the
page invoke the querystring and replace the dash with a pound sign and
navigate to it...

Yama
 
Y

Yama

Hi forgot to mention that you can play around with HttpUtility object to see
if your solution lies in its utilities.

Yama
 
S

Scott Adamson

heres a tip, i had a similar prob, needing to jump to an anchor on a
page with a querystring, i found that my changing the # to &# as the
last item on the querystring it worked fine, otherwise the # and its tag
was included in the value of the previous querystring element i.e.
&date=01/01/2004#01/01/2004 gave "01/01/2004#01/01/2004" but replacing
the # with &# fixed the prob
 

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

Top