开发环境:vs2012
注:子内容页所需的style样式和using引入包 需要加入母板中
shopdata_MasterPage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="shopdata_MasterPage.master.cs" Inherits="shopdata_MasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>shopdata模版页</title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.auto-style1 {
width: 100%;
border-style: solid;
border-width: 0px;
align-content: center;
}
.auto-style4 {
height: 20px;
width: 127px;
}
.auto-style5 {
width: 127px;
}
.auto-style6 {
height: 20px;
width: 124px;
}
.auto-style7 {
width: 124px;
}
.auto-style8 {
width: 124px;
height: 23px;
}
.auto-style9 {
width: 127px;
height: 23px;
}
.foot {
width: 100%;
background-color: gray;
color: white;
text-align: center;
bottom: 10px;
}
.content {
float: none;
height:900px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class ="auto-style1">
<div class="img_head">
<asp:Image ID="headImg" runat="server" imageUrl="images/head.jpg" />
</div>
<div>
<asp:Menu ID="menu" runat="server" Orientation="Horizontal" Height="28px" Width="100%">
<Items>
<asp:MenuItem NavigateUrl="~/default.aspx" Text="首页" Value="首页"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/login.aspx" Text="登录" Value="登录"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/register.aspx" Text="注册" Value="注册"></asp:MenuItem>
<asp:MenuItem Text="浏览" Value="浏览">
<asp:MenuItem NavigateUrl="~/showGuest.aspx" Text="客户信息" Value="客户信息"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/showProduct.aspx" Text="分类商品信息" Value="分类商品信息"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/showAllProduct_dataList.aspx" Text="全部商品" Value="全部商品"></asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>
</div>
<div class="content">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div class="foot">Copyright@2017, CCIT, All Rights Reserved</div>
</div>
</form>
</body>
</html>
default.aspx
<%@ Page Title="首页" Language="C#" MasterPageFile="~/shopdata_MasterPage.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<%-- 子内容页开始 --%>
<br />
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/login.aspx">点击登陆</asp:HyperLink>
<br />
<%-- 子内容页结束 --%>
</asp:Content>