0
这是一个嵌套母版页的在我的项目代码:内容Web窗体不允许添加内容
<%@ Master Language="C#" MasterPageFile="~/Presentation_Layer/Pages/home.Master" AutoEventWireup="true" CodeBehind="cmsNestedMasterPage.master.cs" Inherits="livetest.Presentation_Layer.Pages.cmsNestedMasterPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="divMenuSideBarLeft" class="MainSideBar1Div" style="top: 2px"
title="LiveTest CMS Menu">
</div>
<div id="divCmsContent" class="MainContentDiv" title="divCmsContent"
style="background-color: ButtonFace; width: 791px; left: 203px; position:relative; top: -602px;">
</div>
</asp:Content>
我有以下疑问:
- 第一
ContentPlaceHolder
ContentPlaceHolderID="head"
,它是什么对于?当我将这个嵌套母版页添加到我的项目中时,两个ContentPlaceHolder
都自动添加。 - 在第二个
ContentPlaceHolder
与ContentPlaceHolderID="ContentPlaceHolder1"
,我加了两个div
s。一种是在左边显示一个侧栏,另一个是我要显示表单的位置。问题是,当我添加了一个新的Web内容形式,并将其链接到该母版页,它只有一个预先写好行:
<%@ Page Title="" Language="C#"
MasterPageFile="~/Presentation_Layer/Pages/cmsNestedMasterPage.master"
AutoEventWireup="true" CodeBehind="BookEntry.aspx.cs"
Inherits="livetest.Presentation_Layer.Pages.CMS.BookEntry" %>
的代码没有显示任何ContentPlaceHolder
秒。即使我尝试添加一个,它会给出错误:
The page has one or more
<asp:Content>
controls that do not correspond with<asp:ContentPlaceHolder>
controls in the Master page.
如何纠正此错误?
这意味着上面显示的ContentPlaceHolderID对应于嵌套主页面。 – RKh 2010-11-16 09:16:36
@RPK - yes cphCmsDiv对应于嵌套masterpage中ContentPlaceHolder的ID。编辑我的答案以显示更完整的示例 – 2010-11-16 09:21:11