Monday, 26 March 2012

To Reference ASP.Net Master page content, content pages


To Access Content Page TextBox Value in MasterPage:

TextBox txtB = (TextBox)ContentPlaceHolder1.FindControl("txtContentPg");
txtMaster.Text = "Content Page TextBox Value: " + txtB.Text;

To Access Master Page Label Value in ContentPage:

Label l1 = (Label)Master.FindControl("lblMaster");
lblContentPg.Text = "Master Page Label = "+l1.Text;