Can a masterpage reference another masterpage with the same content and contentplaceholder tags?

Posted by Peach on Stack Overflow See other posts from Stack Overflow or by Peach
Published on 2011-01-08T01:48:06Z Indexed on 2011/01/08 1:53 UTC
Read the original article Hit count: 638

Filed under:
|
|

Current Setup

I currently have three masterpages and content pages in the following hierarchy :

  • One root-level masterpage that displays the final result. Call this "A"
  • Two sibling pages that don't reference each other but contain all the same contentplaceholder elements, just in a different order with different <div>'s surrounding them. Both reference the root-level masterpage. Call these "B1" and "B2".
  • Several content pages that reference one or the other sibling master pages above (not both). Call these "C1" through "C-whatever".

Basically I have:

Cn => B1 => A

Cm => B2 => A

This hierarchy works fine.

Desired Setup

What I want to do is add in a new level to this hierarchy (a new master page) between the content pages and the sibling masterpages. Basically so it's like this:

  • One root-level masterpage that displays the final result.
  • Two sibling pages plus a third sibling. Call it B3
  • A new middle masterpage that dynamically 'chooses' one of the sibling masterpages. The desired behaviour is to pass through the content given by C directly to Bn without modifying it. The only thing D actively does is choose which Bn. Call this new masterpage D.
  • Several content pages that reference the new middle master page instead of the old siblings.

The challenge to this is, I'm working within the confines of a rather complex product and I cannot change the original two sibling masterpages (B1 and B2) or content pages (C) in any meaningful way.

I want:

Cn => D => B1 => A

Cm => D => B2 => A

Ck => D => B3 => A

Essentially, D should "pass through" all it's content to whichever B-level masterpage it chooses. I can't put this logic in the C-level pages.

Additional Details

  • All B-level pages have the same content/contentplaceholder tags, just ordered and styled differently.
  • D can be as convoluted as it has to be, so long as it doesn't require modifying C or B.
  • I'm using ASP.Net 2.0

Is this possible?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about master-pages