Answer: You can assign a master page dynamically in the PreInit event of the content page by using the Page class MasterPageFile property. Below is the code snippet to assign a master page dynamically.
void Page_PreInit(Object sender, EventArgs e)
{
this.MasterPageFile = "MasterPage.master";
}
Asked In: Many Interviews |
Alert Moderator