shaqtus 0 Newbie Poster

OK, so in Visual Web Developer, I've created a master page that has 2 textboxes (one for a user name, one for a password), and then I have a content holder (note that the 2 textboxes are outside of the content holder.) I also have a web form that is working off the master page I just described, and for this web form, I need to be able to read the values of the textboxes from the master page. This is what I've devised to be able to do that:

Master Page code file - Name: AdminLoginMaster

protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public string EmailAddress
    {
        get { return txtEmail.Text; }
    }

    public string Password
    {
        get { return pwdPassword.Text; }
    }

Web form code file

protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        MasterPages_AdminLoginMaster a = new MasterPages_AdminLoginMaster();
        string email = a.EmailAddress;
        string pw = a.Password;
    }

As you can see, I'm trying to place the text of the password box from the master page into the string called "pw" on the web form (same with the email string). This isn't working because I can't access the public properties "EmailAddress" and "Password" from the web form. They won't show up in the smart-menu thing that comes after the period in C# syntax. Why can't I access the public properties in the master page from the web form?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.