Friday, July 31, 2015

How to Access MasterPage Control Property in Content Page

Create object for control in content page which you want to access and initialize it like this

TextBox l =(TextBox) this.Master.FindControl("TextBox1");
//here Textbox1 is id which is in master page

Label1.Text = l.Text;
//Label1 is in content page which get the text from master page
       
l.Text = "Done...";
//set some text to control which is in MastePage