ASP.NET Podcast

ASP.NET Podcast is geared towards the Microsoft .NET Framework and ASP.NET.
The podcast is run by Wally McClure, David Penton, and Paul Glavich.
Welcome to ASP.NET Podcast Sign in | Join | Help
in Search

ASP.NET Podcast

The ASP.NET Podcast features, technical talks, interviews, news, reviews, and Wallyisms. Wallace B. (Wally) McClure, David Penton, and Paul Glavich are your hosts. We talk about ASP.NET, AJAX, Performance, Databases, WCF, Silverlight, Cloud Computing, Windows Azure, and whatever else we decide to talk about.

ASP.NET Podcast Show #99 - Nested Master Pages in Visual Studio 2008 (video and audio)

Subscribe <-- What everyone wants.

Download as WMV

Download as M4V for iPod and Zune

Download as MP3 audio only

Show Notes:

This show is a video demo of creating a nested master page in Visual Studio 2008.

The source code for the parent master page is:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPageParentSimple.master.cs" Inherits="MasterPageParentSimple" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Simple Parent Master Page.<br />
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
       
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

The source code for the example child master page is:

<%@ Master Language="C#" MasterPageFile="~/MasterPageParentSimple.master" AutoEventWireup="false" CodeFile="MasterPageChildSimple.master.cs" Inherits="MasterPageChildSimple" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    Simple Child Master Page<br />
    The location of the ContentPlaceHolder was the one hangup I had.<br />
    <asp:ContentPlaceHolder ID="Content3" runat="server">
    </asp:ContentPlaceHolder>
</asp:Content>

The source code for the example simple out page is:

<%@ Page Language="C#" MasterPageFile="~/MasterPageChildSimple.master" AutoEventWireup="true" CodeFile="DefaultSimpleMasterPageExample.aspx.cs" Inherits="DefaultSimpleMasterPageExample" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content3" Runat="Server">
    this is some basic content. this is more content.
</asp:Content>

Here is some exact output (not a perfect match, but close).

Nested Master page output

If you want to see some more on nested master pages, check this post out:

http://morewally.com/cs/blogs/wallym/archive/2007/08/09/visual-studio-2008-thursday-august-9-2008.aspx

 

Published Wednesday, August 22, 2007 9:07 PM by admin
Filed under: ,
Anonymous comments are disabled

This Blog

Syndication

Powered by Community Server, by Telligent Systems