Thursday, March 22, 2012

newbie hyperlink question

Hi,

Just playing around using the QuickStart site. I placed this code in my code
behind:

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Set hyperlink to "~", which indicates application root.
link1.NavigateUrl = "~"
End Sub

this code in my page:

<asp:hyperlink ID="link1" runat="server">this link test</asp:hyperlink>

The tutorial has me placing the sub in the page itself -- but shouldn't this
work regardless? It displays the text as a link but hovering over it does
nothing.

thanksDo you want the link to go to another page..
What do you want it to do when you hover over it?
Patrick

"thersitz" <thersitz@.gmail.comwrote in message
news:upGZO8sKHHA.4376@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hi,
>
Just playing around using the QuickStart site. I placed this code in my


code

Quote:

Originally Posted by

behind:
>
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Set hyperlink to "~", which indicates application root.
link1.NavigateUrl = "~"
End Sub
>
this code in my page:
>
<asp:hyperlink ID="link1" runat="server">this link test</asp:hyperlink>
>
The tutorial has me placing the sub in the page itself -- but shouldn't


this

Quote:

Originally Posted by

work regardless? It displays the text as a link but hovering over it does
nothing.
>
thanks
>
>
>
>
>
>
>


Instead of "~" try "~/" for the navigateurl.

--

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

"thersitz" <thersitz@.gmail.comwrote in message
news:upGZO8sKHHA.4376@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hi,
>
Just playing around using the QuickStart site. I placed this code in my
code behind:
>
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Set hyperlink to "~", which indicates application root.
link1.NavigateUrl = "~"
End Sub
>
this code in my page:
>
<asp:hyperlink ID="link1" runat="server">this link test</asp:hyperlink>
>
The tutorial has me placing the sub in the page itself -- but shouldn't
this work regardless? It displays the text as a link but hovering over it
does nothing.
>
thanks
>
>
>
>
>
>
>


thanks.

I originally had the file name -- "default.aspx" as the target -- and a file
by that name in the same directory -- but still the link would not activate
on viewing the page -- the style sheet viewed it as a link and applied the
appropiate style but no link functionality upon hovering over it. I have to
run but will try your suggestion first thing in the morn.

thanks for the response.

"Mark Fitzpatrick" <markfitz@.fitzme.comwrote in message
news:u1HAHXtKHHA.4912@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Instead of "~" try "~/" for the navigateurl.
>
>
--
>
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
>
>
"thersitz" <thersitz@.gmail.comwrote in message
news:upGZO8sKHHA.4376@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>Hi,
>>
>Just playing around using the QuickStart site. I placed this code in my
>code behind:
>>
> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
> ' Set hyperlink to "~", which indicates application root.
> link1.NavigateUrl = "~"
> End Sub
>>
>this code in my page:
>>
><asp:hyperlink ID="link1" runat="server">this link test</asp:hyperlink>
>>
>The tutorial has me placing the sub in the page itself -- but shouldn't
>this work regardless? It displays the text as a link but hovering over it
>does nothing.
>>
>thanks
>>
>>
>>
>>
>>
>>
>>


>
>


Thanks Patrick.

Well, when I hover over it I expected my cursor to change to a hand pointing
cursor and respond as if it were a regular html link and thus allow me to
click and follow the url assigned to it. It does neither. The style sheet
treats it as a link and formats it accordingly. But hovering over it, the
response is the same as hovering over any non-link text.

I have changed the link1,NavigateURL to "default.aspx" with a file so named
in the same directory as the page. I have changed it to "~/" as per another
suggestion made on this thread. And no go.

So I am missing something fairly fundamental. Any ideas. I took this stuff
right off the asp.net tutorial.

"Patrick.O.Ige" <naijacoder@.hotmail.comwrote in message
news:eYk9uStKHHA.5000@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Do you want the link to go to another page..
What do you want it to do when you hover over it?
Patrick
>
"thersitz" <thersitz@.gmail.comwrote in message
news:upGZO8sKHHA.4376@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>Hi,
>>
>Just playing around using the QuickStart site. I placed this code in my


code

Quote:

Originally Posted by

>behind:
>>
> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
> ' Set hyperlink to "~", which indicates application root.
> link1.NavigateUrl = "~"
> End Sub
>>
>this code in my page:
>>
><asp:hyperlink ID="link1" runat="server">this link test</asp:hyperlink>
>>
>The tutorial has me placing the sub in the page itself -- but shouldn't


this

Quote:

Originally Posted by

>work regardless? It displays the text as a link but hovering over it does
>nothing.
>>
>thanks
>>
>>
>>
>>
>>
>>
>>


>
>

0 comments:

Post a Comment