ASP.net基础编程2—母版嵌套

2 篇文章 0 订阅

开发环境: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>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值