Razor,aspx的占位控件(母版页)

1.razor:

母版页中:
@*类似master的占位控件*@ @RenderSection("scripts", required: false)

部分页中: @section scripts{ }

2.aspx:

.master
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>

 

 

**使用母版页的aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MasterPage.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
haha
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="width:100%;height:400px; border:1px solid;" >content</div>
</asp:Content>

 

posted @ 2017-11-02 17:32  fight139  阅读(481)  评论(0编辑  收藏  举报