在ASP.NET2.0中实现主页嵌套

网络整理 - 08-08

为了理解如何建立嵌套主页,下面让我们看一个例子。首先给出一个标准主页的例子。

以下是引用片段:
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="WebsiteMasterPage.master.cs" Inherits="WebsiteMasterPage" %>
<html>
 <head runat="server" id="head">
    <title>标准主页例子</title>
 </head>
 <body>
   <form id="form1" runat="server">
     <table width="100%">
       <tr>
         <td bgcolor="#006633" colspan="2">
           <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
               <td align="left">
                 <a href="/MasterPage/Default.aspx">
                   <img alt="Home Page" border="0" src=http://www.chinahtml.com/0703/"/MasterPage/images/logo.gif" />
                 </a>
               </td>
               <td align="right">
                 <img src=http://www.chinahtml.com/0703/"/MasterPage/images/header_image.gif"/>
               </td>
             </tr>
           </table>
         </td>
       </tr>
       <tr>
         <td width="25%">
           <font color="#3300FF">部门1 <br /> 部门2 <br /></font>
         </td>
         <td width="75%">
             <asp:ContentPlaceHolder ID="Main" runat="server">
             </asp:ContentPlaceHolder>
         </td>
       </tr>
       <tr>
         <td colspan="2"> </td>
       </tr>
       <tr>
         <td bgcolor="#0000FF" colspan="2">
               <font color="#FFFF00">注脚</font>
         </td>
       </tr>
     </table>
   </form>
 </body>
</html>