繁体   English   中英

内容页没有母版页的内容

[英]Content Page does not have content of Master Page

母版页内容:

<form id="form1" runat="server">
<div>
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">        
    <center>
   <table border="0" cellspacing="0" style="border-collapse: collapse; border-top-width:0" bordercolor="red" width="970" bgcolor="#DDE1EE" cellpadding="0">
//all contents

</table>   
    </center>
    </asp:ContentPlaceHolder>
</div>
</form>

内容页:

<%@ Page Title="" Language="C#" MasterPageFile="~/CambridgeMaster.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button1" runat="server" Text="Button" />

</asp:Content>

在我的内容页面中,我找不到任何母版页内容。

它的工作方式略有不同。

它将“内容”页面的内容注入到ContentPlaceholders中(有效替换其中的任何内容)。

您可以将ContentPlaceholder放置在要显示内容页面html的位置。

    <center>
   <table border="0" cellspacing="0" style="border-collapse: collapse; border-top-width:0" bordercolor="red" width="970" bgcolor="#DDE1EE" cellpadding="0">
//all contents
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> 
 </asp:ContentPlaceHolder>
</table>   
    </center>

请注意,我已将其放置在桌子内,并将其留空。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM