Frequently Asked Interview Questions

Interview Questions on Master pages

Interview questions on Master Pages - page2
Yes, a master page can assign to any page dynamically through code, at pre initialization stage of a page, code shown below.

protected override void Page_PreInit(object sender, EventArgs e)
{
this.MasterPageFile = “~/MainMenu.master”;
}
NO
Use FindControl() method to access any control of master page in content
page, code shown below.

//Get reference of Content place
ContentPlaceHolder cph = (ContentPlaceHolder) Master.FindControl(“ContentPlaceHolder1”);
Control con = cph.FindControl(“controlname”);
Yes.

Most Visited Pages

Home | Site Index | Contact Us