Saturday, March 24, 2012

newbie: trouble with asp:HyperLink

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?

JeffJeff,
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.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

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
>
>
>
>
>


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" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

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
>
>
>
>
>


okay, thanks

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.netwrote in message
news:uTpSbPu$GHA.3928@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>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" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>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

0 comments:

Post a Comment