Thursday, 16 December 2010

How can you assign a Master Page dynamically?

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";

}

No comments:

Post a Comment