Call MasterPage Controls from the aspx page

Posted by Gopesh9 under ASP.NET category on | Points: 40 | Views : 1207
Suppose Master Page contains a Label Control whose id is labelMaster in it. Now in the aspx page you will write.

Label labelChild = (Label)Master.FindControl("labelMaster");
labelChild.Text = "Just Checking";
labelChild.BackColor = System.Drawing.Color.Red;
labelChildForeColor = System.Drawing.Color.Blue;
labelChild.Font.Bold = true;

Comments or Responses

Login to post response