tags:

views:

209

answers:

2

Is there anyway to set a Master Page's Master Page programmaticly? Would I need to do this on each page? I don't have access to the pre_init event from Master. Hrm...

+3  A: 
void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/NewMaster.master";
}

Working with ASP.NET Master Pages Programmatically

Koistya Navin
+1  A: 

In the PreInit function place:

this.MasterPageFile = "~/masterPage.master";

Yes, you will need to put this on each page. To get aroud it, have all the pages inherit from a base Page and place put the master page reference there.

Kevin
this is the route im going with, so it will look like me.master.masterpagefile
Shawn Simon