How to use Nested MaserPages in VB.Net websites

Well here is a situation.

I create 3 templates and each one of them will have a MasterPage. Eg. TemplateMaster1, TemplateMaster2 and TemplateMaster3

Then I create another MasterPage called SiteMasterPage

and in SiteMaster I call one of the three templates ( eg. TemplateMaster1)

Then I create a default.aspx page which will refer to the SiteMasterPage

Now the <asp:ContentPlaceHolder> tags which are in TemplateMaster1 can not be directly used in my default.aspx page

In order to use them here is a work around

Whereever you want to put the custom content.

Create a  <asp:Content> tag in  your SiteMasterPage first and then within it create a <asp:ContentPlaceHolder> tag

Here is an example.

<asp:Content ID=”Main”  ContentPlaceHolderID=”TemplateMain” runat=”server”>
<asp:ContentPlaceHolder ID=”MasterMain” runat=”server”>



Then in your default.aspx page you can place the MasterMain

<asp:Content Id=”Main” ContentPlaceHolderID =MasterMain runat=”server”>

<h1>Welcome to this content  which is using nested masterpages</h1>