Nested master page (C#) : Master page « User Control and Master Page « ASP.Net






Nested master page (C#)

<%@ page language="C#" MasterPageFile="MasterPage5.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>


<%-- MasterPage5.master
<%@ master language="C#" MasterPageFile="MasterMasterPage5.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>

--%>


<%-- MasterMasterPage5.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>

--%>


           
       








Related examples in the same category

1.Use master page (C#)
2.Master page with trace (C#)
3.Two Master Pages (C#)
4.Link content page with master page
5.Master page with Default Content
6.Master in page derivative
7.Two pieces of contentplaceholder
8.master for print
9.Control title in master page with content page code
10.Nested master page
11.Use image to fill the filler in master page
12.Code behind and master page
13.Specifying master page in Web.config causes every content page to inherit from the master page
14.Specifying the master page for a specific folder in the Web.config file: Use
15.A master page that creates a GUID on the first request (C#)
16.A master page that creates a GUID on the first request (VB)
17.A master page that exposes a custom property (C#)
18.A master page that exposes a custom property (VB)
19.Exposing a server control from a master page as a public property (C#)
20.Exposing a server control from a master page as a public property (VB)
21.Overriding some default content in the content page (C#)
22.Overriding some default content in the content page (VB)
23.Using Page_PreInit to assign the master page programmatically (C#)
24.Using Page_PreInit to assign the master page programmatically (VB)
25.A content page that can work with more than one master page
26.Update the page properties in master page
27.Nested master
28.Put site navigation in the master page
29.Master pages exposing an object model for content pages to programmatically modify elements on the master.