You can assign the master page dynamically with the help of Page class property called MasterPageFile
. You can assign this when the page is in PreInit stage. Below is the sample code to assing master page dynamically.
void Page_PreInit(Object sender, EventArgs e)
this.MasterPageFile = "~/MasterPage.master";
Asked In: Many Interviews |