ASP.NET
  Home arrow ASP.NET arrow Page 3 - Creating a Nested Master Page
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Creating a Nested Master Page
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2006-12-06

    Table of Contents:
  • Creating a Nested Master Page
  • Nested Master Project
  • Embedded master pages
  • What can go wrong?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating a Nested Master Page - Embedded master pages


    (Page 3 of 4 )

    In addition to the master page, there are two embedded master pages in the master, individually called FChild.master and SChild.master. The listing shown in the next section is for the FChild.master. Observe that the source of this page follows very nearly the same form as any other content page, but it has another ContentPlaceHolder of its own. The FChild.master cannot be displayed in the design view, as it is a kind of a virtual page.

    Code for FChild.master

    <%@ Master Language="VB"  
    MasterPageFile="~/top.master" 
    CodeFile="FChild.master.vb" 
    Inherits="FChild" %>
    <asp:Content ID="Content2" 
    runat="server" 
    ContentPlaceHolderID="ContentPlaceHolder1">
    <h3 style="color:Navy">Master's First Child </h3>
    <asp:ContentPlaceHolder ID="Content1" runat="server" />
    <h4 style="font-style:italic; color:Navy;">First Child 
    Designer</h4>
    </asp:Content> 

    The FChild.master design page cannot be displayed; if you try, you will get the following message. However you can code an aspx page to reveal it as shown in the following section. FPage.aspx provides the content for the nested master file, FChild.master.

    Source of FPage.aspx

    <%@ Page Language="VB" 
    MasterPageFile="~/FChild.master" 
    AutoEventWireup="false" 
    CodeFile="FPage.aspx.vb" 
    Inherits="FPage" %>
    <asp:Content ContentPlaceHolderID="Content1" runat="server">
    <h4>Content for the Master's First Child</h4>
    <table style="border-style:solid;border-width:medium;">
    <tr style="background-color:yellow">
    <td>Name</td><td>EMAIL</td>
    </tr>
    <tr>
    <td>Jay Krishnaswamy</td><td>htek@mysorian.com</td>
    </tr>
    </table>
    </asp:Content>
    
    FPage.aspx

    Code for SChild.master

    <%@ Master Language="VB" 
    MasterPageFile="~/top.master" 
    CodeFile="SChild.master.vb" 
    Inherits="SChild" %>
    <asp:Content runat="server" 
    ContentPlaceHolderID="ContentPlaceHolder1">
    <h3 style="font-weight:500; color:Fuchsia;"> Master's Second Child </h3>
    <asp:contentplaceholder id="Content2" 
    runat="server">
    </asp:contentplaceholder>
    <h4 style="font-style:italic;color:Fuchsia;"> Second Child Designer</h4>
    </asp:Content>
    

    As discussed in the previous section, this SChild.master cannot be displayed in the design view. However we can develop some content to show this nested master page by using the code shown in the next section.

    Source of SPage.aspx

    <%@ Page Language="VB" 
    MasterPageFile="~/SChild.master" 
    AutoEventWireup="false" 
    CodeFile="SPage.aspx.vb" 
    Inherits="SPage" %>
    <asp:Content ID="Content3" 
    ContentPlaceHolderID="Content2" 
    runat="server">
    <h4>Content for the Master's Second Child</h4>
    <img src=http://images.devshed.com/af/stories/images/usa-small.gif 
    alt="US Flag"/> </asp:Content>

    This page will be displayed as shown when it is opened by Internet Explorer.

    SPage.aspx

    More ASP.NET Articles
    More By Jayaram Krishnaswamy


       · For an organization with many functional units nested master pages can provide a...
     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT