Mega Code Archive

 
Categories / ASP.Net / User Control And Master Page
 

Nested master page

<%@ page language="C#" MasterPageFile="~/Default.master" %> <asp:content id="Content1" contentplaceholderid="Content1" runat=server>    <asp:label runat="server" id="Label1"          text="Child label1" font-bold="true"/>    <br> </asp:content> <asp:content id="Content2" contentplaceholderid="Content2" runat=server>    <asp:label runat="server" id="Label2"          text="Child label2" font-bold="true"/> </asp:content> File: Default.master <%@ master language="C#" MasterPageFile="~/MasterDefault.master" %>  <asp:content id="Content1" contentplaceholderid="MainContent" runat="server">    <asp:panel runat="server" id="panelMain" backcolor="lightyellow">    <h2>Child master</h2>       <asp:panel runat="server" id="panel1" backcolor="lightblue">         <p>This is childmaster content.</p>         <asp:contentplaceholder id="Content1" runat="server" />       </asp:panel>       <asp:panel runat="server" id="panel2" backcolor="pink">          <p>This is childmaster content.</p>          <asp:contentplaceholder id="Content2" runat="server" />       </asp:panel>    </asp:panel> </asp:content> File: MasterDefault.master <%@ Master Language="C#" %>  <HTML> <BODY> <form id="Form1" runat=server>    <h1>Parent Master</h1>    <p>    <font color=red>This is Parent-master content.</font>    </P> <asp:contentplaceholder id="MainContent" runat=server/> </form> </HTML> </BODY>