how to access master page control from content page
In Content page you can access the label and set the text such as
Here 'lblStatus' is the your master page label ID
Label lblMasterStatus = (Label)Master.FindControl("lblStatus"); lblMasterStatus.Text = "Meaasage from content page";
In the MasterPage.cs file add the property
of Label
like this:
public string ErrorMessage
{
get
{
return lblMessage.Text;
}
set
{
lblMessage.Text = value;
}
}
On your aspx
page, just below the Page Directive add this:
<%@ Page Title="" Language="C#" MasterPageFile="Master Path Name"..... %>
<%@ MasterType VirtualPath="Master Path Name" %> // Add this
And in your codebehind(aspx.cs)
page you can then easily access the Label Property
and set its text
as required. Like this:
this.Master.ErrorMessage = "Your Error Message here";