Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ASP.NET FindControl on MasterPage

Avatar of Phil5780
Phil5780 asked on
C#ASP.NET
5 Comments1 Solution385 ViewsLast Modified:
Hello All,

So I'm building a web page in ASP.NET/C# and have created a baseClass which implements login validation.  When my web page code behind is run its class inherits as follows:

public partial class ArchiveDash : LoginBaseClass
{

ArchiveDash is using a single master page with a control on it.  How do I access my master page control from my "LoginBaseClass"?  I tried to reach my controls like this but only received nulls:  (attached below)


//Intercept master page controls
        System.Web.UI.WebControls.HyperLink linkLocalLogIn = (System.Web.UI.WebControls.HyperLink)this.Page.FindControl("linkLogIn");
        System.Web.UI.WebControls.HyperLink linkLocalLogOut = (System.Web.UI.WebControls.HyperLink)this.Page.FindControl("linkLogOut");
        System.Web.UI.WebControls.Label lblLocalWelcomeUser = (System.Web.UI.WebControls.Label)this.Page.FindControl("lblWelcomeBackUser");

        
        //Toggle welcome banner
        if ((linkLocalLogIn != null) && (linkLocalLogOut != null))
        {
ASKER CERTIFIED SOLUTION
Avatar of kaylanreilor
kaylanreilorFlag of Luxembourg image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers