ASP.NET FindControl on MasterPage

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

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If your base class inherits from the master page I think that you should use the Master property instead of Page.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
So, as I said, you have an example here :
This article is one of the most comprehensive and well written about Master page tips and tricks. I hope you will find this extremely useful
Mohit MohanCommented:
Looks like u r trying to achieve similar to the scenario discussed here:
Phil5780Author Commented:
Thanks allot, I found the same thing:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.