NavigateURL question

T

tshad

I need to explicitly use the path of my page and am trying to do the
following:

<asp:Hyperlink ID="test" Text="HyperLinkTest" NavigateUrl=<%#
request.ServerVariables("PATH_INFO").Substring(0,request.ServerVariables("PATH_INFO").LastIndexOf("/")+1)
& "displayCompanyOverview.aspx" %> runat="server"/><br>

This doesn't work as it only displays static text.

In my trace statement,
request.ServerVariables("PATH_INFO").Substring(0,request.ServerVariables("PATH_INFO").LastIndexOf("/")+1)
& "displayCompanyOverview.aspx" equates to
"/jobseeker/displayCompanyOverview.aspx" which looks correct?

I assume my syntax is wrong.

Do I need to do some type of "Eval" to make this work?

Thanks,

Tom
 
F

fd123456

Hi Tom,

You cannot use the <% %> tags within server attributes, only within
"normal" attributes (eg : it's ok for "href", "src", "id" but not for
"Text", "NavigateUrl", ImageUrl"...).

Easiest way around : drop the HyperLink and use a normal link
instead :

<a id="test" href='<%=
request.ServerVariables("PATH_INFO").Substring(0,request.ServerVariables("P­
ATH_INFO").LastIndexOf("/")+1)
& "displayCompanyOverview.aspx" %>'>HyperLinkTest</a>

This should work.

Michel
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top