You need to acces the EmployeeName value and display the value within the lblEmployeeName label

You are developing an ASP.Net web application. The application includes a master page named
CustomerMaster.master that contains a public string property name EmployeeName application also
includes a second master page named NestedMaster.master that is defined by the following
directive.
<%@ Master Language=”C#”
MasterPageFile=”~/CustomMaster.Master”
CodeBehind=”NestedMaster.Master.cs”
Inherits=”MyApp.NestedMaster”%>
You add a content page that uses the NestedMaster.master page file.The content page contains a
label control named lblEmployeeName. You need to acces the EmployeeName value and display the
value within the lblEmployeeName label. What should you do?

You are developing an ASP.Net web application. The application includes a master page named
CustomerMaster.master that contains a public string property name EmployeeName application also
includes a second master page named NestedMaster.master that is defined by the following
directive.
<%@ Master Language=”C#”
MasterPageFile=”~/CustomMaster.Master”
CodeBehind=”NestedMaster.Master.cs”
Inherits=”MyApp.NestedMaster”%>
You add a content page that uses the NestedMaster.master page file.The content page contains a
label control named lblEmployeeName. You need to acces the EmployeeName value and display the
value within the lblEmployeeName label. What should you do?

A.
Add the following code segment to the code-behind file of the content page.
public void Page_load(object s, EventArgs e)
{
lblEmployeeName.text=
((MyApp.CustomMaster)Page.Master.Parent).EmployeeName;
}

B.
Add the following directive to the content page.
<%@ MasterTypeVirtualPAth=”~/CustomMaster.master” %>
Add the following code segment to the code-behind file of the content page.
public void Page_load(object s, EventArgs e)
{
lblEmployeeName.text=this.Master.EmployeeName;
}

C.
Add the following code segment to the code-behind file of the content page.
public void Page_load(object s, EventArgs e)
{
lblEmployeeName.text=
((MyApp.CustomerMaster)Page.Master.Master).EmployeeName;
}

D.
Add the following code segment to the code-behind file of the content page.
public void Page_load(object s, EventArgs e)
{
lblEmployeeName.text=
((MyApp.CustomerMaster)Page.Master.Master)
.FindControl(“EmployeeName”).toString();
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *