问题描述
[HttpException(0x80004005):在母版页'/WebSite2/Site.master'中找不到ContentPlaceHolder'HeadContent',在内容页面中验证内容控件的ContentPlaceHolderID属性。] System.Web.UI.MasterPage.CreateMaster(TemplateControl) owner,HttpContext context,VirtualPath masterPageFile,IDictionary contentTemplateCollection)+566 System.Web.UI.Page.get_Master()+54 System.Web.UI.Page.ApplyMasterPage()+ 14 System.Web.UI.Page.PerformPreInit() +45 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+335
我的代码如下
[HttpException (0x80004005): Cannot find ContentPlaceHolder 'HeadContent' in the master page '/WebSite2/Site.master', verify content control's ContentPlaceHolderID attribute in the content page.] System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +566 System.Web.UI.Page.get_Master() +54 System.Web.UI.Page.ApplyMasterPage() +14 System.Web.UI.Page.PerformPreInit() +45 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +335
my code is as follows
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
<style type="text/css">
.style1
{
font-size: x-small;
}
.style2
{
font-size: small;
text-decoration: underline;
}
</style>
</head>
<body>
<form id="Form1" runat="server">
<div class="page">
<div class="header">
<div class="title">
<h1>
<span class="style8"> </span><span class="style7"><span>
class="style2">QUIMZTECH SOLUTIONS</span></span><span class="style1"> </span>
<span class="style5"><span class="style1">Imagination / Innovation /Technology</span></span></h1>
</div>
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
<asp:MenuItem Text="Quotation" Value="Quotation">
<asp:MenuItem NavigateUrl="~/Quotation.aspx" Text="New Quotation"
Value="New Quotation">
<asp:MenuItem NavigateUrl="~/Quotation.aspx" Text="Revise Quotaion"
Value="Revise Quotaion">
<asp:MenuItem NavigateUrl="~/SearchQuotation.aspx" Text="Search Quotation"
Value="Search Quotation">
<asp:MenuItem Text="Invoice" Value="Invoice">
<asp:MenuItem NavigateUrl="~/Invoice.aspx" Text="Search Invoice"
Value="Search Invoice">
</items>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"/>
</div>
<div class="clear">
<p style="padding: 0px; margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 1.5em; font-family: Arial, Helvetica, sans-serif; color: rgb(51, 51, 51); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); height: 0px; width: 1034px;">
Copyright © Quimztech Solutions 2012.All rights reserved.ved.<span>|</span><a>
href="http://www.quimztech.com/sitemap.html"
style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 1.5em; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 0, 0); text-decoration: none;">Sitemap</a><span>|</span><a>
href="http://www.quimztech.com/#"
style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 1.5em; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 0, 0); text-decoration: none;">Terms
of Use</a></p>
</div>
</div>
</form>
</body>
</html>
推荐答案
在母版页'/WebSite2/Site.master'中找不到ContentPlaceHolder'HeadContent',验证内容控件的内容页面中的ContentPlaceHolderID属性。
Cannot find ContentPlaceHolder 'HeadContent' in the master page '/WebSite2/Site.master', verify content control's ContentPlaceHolderID attribute in the content page.
这意味着您拥有属性 ContentPlaceHolderID
的控件为 HeadContent
,但不幸的是它不在母版页。
所以,要么使用正确的 ContentPlaceHolderID
,位于母版页或只是重命名ContentPlaceHolderID
That means you have control which have the property ContentPlaceHolderID
as HeadContent
, but unfortunately it is not in the Master Page.
So, either use correct ContentPlaceHolderID
, which is in Master Page or just rename the ContentPlaceHolderID
这篇关于大家好我是Asp.Net的新人,我得到了以下错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!