newbie: trouble with asp:HyperLink

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hey

asp.net 2.0

I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com

http://localhost:1794/Test/Controls/ is the folder in which I've placed the
usercontrol using this hyperlink

This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />

Any suggestions?

Jeff
 
Jeff,
You have to preface an external URL with http://. The control won't do
it for you as it can't tell if you're looking to browser to a local page or
want to browse to an external site.
 
okay, thanks



Steve C. Orr said:
I suggest you set the hyperlink's NavigateURL to this:
http://www.helloworld.com

That way it doesn't think its a relative URL since you seem to be linking
to an external site.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net


Jeff said:
hey

asp.net 2.0

I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com

http://localhost:1794/Test/Controls/ is the folder in which I've placed
the usercontrol using this hyperlink

This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />

Any suggestions?

Jeff
 
yes, it can tell if you're looking to browser to a local page or
want to browse to an external site.

You are telling you want to browse to a local page
 
Back
Top