ASP.NET  •  Master Content Reuse

Listing 1. ASP.NET version 2's support for master pages lets you save reusable content in a single file. You can update a Web site easily by changing the master page's contents. This code shows how the ContentPlaceholder control fits into the GolfClubShack master page.

<%@ master language="C#"%>
<%@ register tagprefix="golfclubshack" 
   tagname="Header" 
   src="UserControls/Header.ascx" %>
<%@ register tagprefix="golfclubshack" 
   tagname="Menu" 
   src="UserControls/Menu.ascx" %>
<html>
   <head runat="server">
      <title>GolfClubShack </title>
      <link type="text/css" rel="Stylesheet" 
         href="Style/Style.css" />
   </head>
   <body background="images/sitebkgrd.gif">
      <form id="frmMain" runat="server">
         <table width="100%" cellpadding="0" 
            cellspacing="0">
         <tr>
            <td colspan="2" valign="top">
               <golfclubshack:Header 
                  id="Header1" 
                  runat="server" />
               <img height="1" 
                  src="images/1x1.gif" 
                  width="145">
            </td>
         </tr>
         <tr>
            <td valign="top" width=145>
               <golfclubshack:Menu id="Menu" 
                  runat="server" /> 
            </td>
            <td>
               <asp:contentplaceholder 
                  id="ContentPlaceHolder1" 
                  runat="server">
               </asp:contentplaceholder>
            </td>
         </tr>
         </table>
      </form>
   </body>
</html>