2011-04-04 106 views
1

我遵循此tutorail http://msdn.microsoft.com/en-us/library/ff394517.aspx创建了一个ECB for SharePoint 2010,它打开了一个aspz页面。默认情况下,aspx页面使用default.master。我希望使用minimal.master。更改以下行。SharePoint 2010使用minimal.master

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConvertStatus.aspx.cs" Inherits="Proj.Layouts.Proj.ConvertStatus" DynamicMasterPageFile="~masterurl/default.master" %> 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConvertStatus.aspx.cs" Inherits="Proj.Layouts.Proj.ConvertStatus" DynamicMasterPageFile="/_catalogs/masterpage/minimal.master" %> 

使我得到以下错误:

服务器错误 '/' 应用。

我在文件中唯一的代码是

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> 
    <p>test</p> 
</asp:Content> 

我应该能够使用minimal.master?

更新

内容控制应该说PlaceHolderMain不PlaceHolderMain2

随着Custome错误模式被关闭,我得到以下错误:

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: The referenced file '/_catalogs/masterpage/minimal.master' is not allowed on this page. 

Source Error: 


Line 6: <%@ Import Namespace="Microsoft.SharePoint" %> 
Line 7: <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
Line 8: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConvertStatus.aspx.cs" Inherits="MyProj.Layouts.MyProj.ConvertStatus" MasterPageFile="/_catalogs/masterpage/minimal.master" %> 
Line 9: 
Line 10: <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server"> 


Source File: /_layouts/MyProj/ConvertStatus.aspx Line: 8 

**更新2 **

包含主页面的代码行现在显示为

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConvertStatus.aspx.cs" Inherits="Myproj.Layouts.MyProj.ConvertStatus" DynamicMasterPageFile="~masterurl/minimal.master" %> 

现在,这将产生以下错误,但应该是说我打你使用的ContentPlaceHolderIDs,必须在母版页中存在的母版

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

Content controls are allowed only in content page that references a master page. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Content controls are allowed only in content page that references a master page. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[HttpException (0x80004005): Content controls are allowed only in content page that references a master page.] 
    System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +11010974 
    System.Web.UI.Page.get_Master() +69 
    System.Web.UI.Page.ApplyMasterPage() +18 
    System.Web.UI.Page.PerformPreInit() +58 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1256 
+0

你可以试着改变你的web.config,以便调试错误:http://blog.thekid.me.uk/archive/2007/02/15/a-solution-to-quot-an-unexpected-error-has-occurred-quot-in-wss-v3.aspx你应​​该能够使用minimal.master,但我认为没有更多信息,任何人都无法给出答案。 – 2011-04-04 17:12:56

+0

Kit说什么,并确保你的minimal.master实际上是在/ _catalogs/masterpage文件夹中。请记住,/ _catalogs会转到根网站,因此当您位于/ sites/mysite /时,它将不起作用。 – 2011-04-04 18:22:23

+0

更新的问题与抛出的错误消息。 – Alice 2011-04-05 09:23:00

回答

2

最小母版页有以下:

<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server"/> 
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/> 
<asp:ContentPlaceHolder ID="SPNavigation" runat="server"> 
<asp:ContentPlaceHolder id="PlaceHolderHelpButton" runat="server"> 
<asp:ContentPlaceHolder id="PlaceHolderWelcomeMenu" runat="server"> 
<asp:ContentPlaceHolder id="PlaceHolderDeveloperDashboardLauncher" runat="server"> 
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server"> 
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderPageSubTitle" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderNavSpacer" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderBodyLeftBorder" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderPageImage" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderTitleLeftBorder" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server" /> 
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaSeparator" runat="server" /> 

所以PlaceHolderMain2将无法​​正常工作(除非你把它添加到母版页)

+1

@djeg我的坏内容控制应该说PlaceHolderMain(这是你提供的列表中)。但我仍然遇到错误。 – Alice 2011-04-05 09:22:37