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

Phil5780Asked:
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.

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

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
kaylanreilorCommented:
So, as I said, you have an example here : http://www.west-wind.com/Weblog/posts/5127.aspx.
0
masterpassCommented:
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

http://odetocode.com/Articles/450.aspx
0
Mohit MohanCommented:
Looks like u r trying to achieve similar to the scenario discussed here:
http://stackoverflow.com/questions/903891/accessing-a-master-page-control-from-a-separate-class
0
Phil5780Author Commented:
Thanks allot, I found the same thing:)
0
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
ASP.NET

From novice to tech pro — start learning today.