现在的位置: 首页 > 综合 > 正文

新建及使用母板页

2019年11月17日 ⁄ 综合 ⁄ 共 1074字 ⁄ 字号 评论关闭

添加新项->母版页
,得到页面效果如下:

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

<!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>无标题页</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    俺是母版页的内容

        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
      
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

 

 

/*******************************************************************************************************************************/


加新项,web窗体

勾选将代码放在单独的区域中
和选择母版页

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="neirong.aspx.cs" Inherits="mu" Title="无标题页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
我是内容页

</asp:Content>

 

 

【上篇】
【下篇】

抱歉!评论已关闭.