Reference to LoginView's child controls

Posted on 2006-06-07
Last Modified: 2012-08-14
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.
Question by:maidinhtai
    LVL 20

    Accepted Solution

    I achieved it like this

            HyperLink MyHyperLink = (HyperLink) LoginView1.FindControl("HyperLink1");
            MyHyperLink.NavigateUrl = "";

    you have to find the control and then cast it into a hyper link; I work in C#
    LVL 20

    Expert Comment

    I think the VB counterpart is CType(LoginView1.FindControl("HyperLink1"),HyperLink)
    LVL 27

    Assisted Solution

    Rea_Andrew is correct,
    Dim myLink as hyperlink=CType(LoginView1.FindControl("HyperLink1"),HyperLink)
    mylink.NavigateUrl = ""


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now