How can you assign a Master Page dynamically?

 Posted by Tripati_tutu on 12/15/2010 | Category: ASP.NET Interview questions | Views: 3354 | Points: 40

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 | Alert Moderator 

Comments or Responses

Login to post response