Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.


YOU ARE HERE: HOME Questions How do we access Master Page Controls from Content Pages

Access Master Page Controls from Content Page?

View(s): 15533

How do we access Master Page Controls from Content Pages?

Answer 1)

We can access master page controls from the content pages.  Below are the  examples towards the same.


TextBox tb = (TextBox)Master.FindControl("txtMaster");
tb.Text = "Something";


ContentPlaceHolder mpContentPlaceHolder;
TextBox mpTextBox;
mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

if (mpContentPlaceHolder != null)
    mpTextBox = (TextBox)mpContentPlaceHolder.FindControl("TextBox1");
    if (mpTextBox != null)
        mpTextBox.Text = "TextBox found!";

Example 3:

// Gets a reference to a Label control that is not in a
// ContentPlaceHolder control
Label mpLabel = (Label)Master.FindControl("masterPageLabel");
if (mpLabel != null)
    Label1.Text = "Master page label = " + mpLabel.Text;

  Asked in:  LiquidHub   Expertise Level:  Beginner
  Last updated on Wednesday, 16 January 2013
2/5 stars (5 vote(s))

Register Login Ask Us Write to Us Help