Posted on: 3/27/2011 9:30:47 AM | Views : 284

I've been reading a lot of information about accessing master page controls from content pages, but there's still a scenario to which I can't find a solution.
The following situation works.  On a master page, I create a label as follows:
<asp:label id="lbl" runat="server" text="test"></asp:label> Then, on the content page code behind, I have the following:
protected void Page_Load(object sender, EventArgs e) { Label mpLabel = (Label) Master.FindControl("lbl"); if(mpLabel != null) { Label1.Text = "Master page label = " + mpLabel.Text; } }

However, I specify the value for the label in the code behind of the master page, the text property of mpLabel is null.
<asp:label id="lbl" runat="server"></asp:label> protected void Page_Load(obje ...

Go to the complete details ...