2011-04-04 109 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