News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Advertisement

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;
public partial class CustomMaster : MasterPage 
{
 public string Region
 {
  get; set;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
 }
}

You create a new ASP.NET page and specify Custom.master as its master page.
You add a Label control named lblRegion to the new page.
You need to display the value of the master page's Region property in lblRegion.

What should you do?

 

  1. Add the following code segment to the Page_Load method of the page code-behind file.
    CustomMaster custom = this.Parent as CustomMaster;
    lblRegion.Text = custom.Region;

  2. Add the following code segment to the Page_Load method of the page code-behind file.
    CustomMaster custom = this.Master as CustomMaster;
    lblRegion.Text = custom.Region;

  3. Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
    Label lblRegion = Page.FindControl("lblRegion") as Label; lblRegion.Text = this.Region;

  4. Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
    Label lblRegion = Master.FindControl("lblRegion") as Label; lblRegion.Text = this.Region;

Answer: Answer is b
Further Reading:

Useful resources,, Working with ASP.NET Master Pages Programmatically

comments powered by Disqus
Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;