Reference to LoginView's child controls

I add a loginView control (named loginview1) to a webpage and then add a hyperlink (named hyperlink1) to the loginview control. How can I reference to hyperlink1 in code view mode. For example:
Loginview1.LoggedInTemplate.Hyperlink1.NarvigateURL = "http://" 'This doesn't work
Thank you.
LVL 3
maidinhtaiAsked:
Who is Participating?
 
REA_ANDREWConnect With a Mentor Commented:
I achieved it like this

        HyperLink MyHyperLink = (HyperLink) LoginView1.FindControl("HyperLink1");
        MyHyperLink.NavigateUrl = "http://www.msn.com";

you have to find the control and then cast it into a hyper link; I work in C#
0
 
REA_ANDREWCommented:
I think the VB counterpart is CType(LoginView1.FindControl("HyperLink1"),HyperLink)
0
 
SammyConnect With a Mentor Commented:
Rea_Andrew is correct,
Dim myLink as hyperlink=CType(LoginView1.FindControl("HyperLink1"),HyperLink)
mylink.NavigateUrl = "http://www.msn.com"

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.