Hi Rich,
You can do what you want in ASP.NET 2.0.
Create a master page say Site1.master
Now create another master page say Child.master and set it's master to
Site1.master.
Now the problem you're going to get is that VS doesn't support design dev
with embedded master pages. To work around this you'll need to do the
following:
Create a new class like this:
public class BasePage : System.Web.UI.Page
{
private string runtimeMasterPageFile;
public string RuntimeMasterPageFile
{
get
{
return runtimeMasterPageFile;
}
set
{
runtimeMasterPageFile = value;
}
}
protected override void OnPreInit(EventArgs e)
{
if (runtimeMasterPageFile != null)
{
this.MasterPageFile = runtimeMasterPageFile;
}
base.OnPreInit(e);
}
}
Make each of your child pages (content pages) inherit from this base class.
In the aspx page of each child page add the following attrbiute to the top:
RuntimeMasterPageFile="~/Child.master" and make sure that
MasterPageFile="~/Site1.master".
What this does is use the Site1.master at design time but changes it to use
Child.master at runtime.
You still will not be able to use the design tools to create your
Child.master but will be able to use the designer for all content pages.
Note: I found this code on the web but cannot remember where. I would like
to give credit to the person who wrote (if I knew who it was).
Hope this helps.
-Joe
"Rich" <r@r.rwrote in message
news:45**********************@un-2park-reader-01.sydney.pipenetworks.com.au...
Hi,
I want to use 2 master pages, one for the main part of the site, the other
for the admin pages.
They are quite similar, with many shared elements.
Ideally I would like to have a parent master page, which both of these
child master pages are based on, and in turn the final pages are based on
one of these child master pages.
This would form an inheritance hierarchy, so any change could be made to
the parent master page, which would affect both children, or to each child
individually.
Is this possible?
Cheers
Rich.