开发者

SharePoint 2010 using minimal.master

I have followed this tutorail http://msdn.microsoft.com/en-us/library/ff394517.aspx to create an ECB for SharePoint 2010 which opens up a aspz page. By default the aspx page uses default.master. I wish to use minimal.master. Changing the following line.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConvertStatus.aspx.cs" Inherits="Proj.Layouts.Proj.ConvertStatus" Dyna开发者_运维技巧micMasterPageFile="~masterurl/default.master" %>

to

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

causes me to get the following error:

Server Error in '/' Application.

The only code I have in my file is

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

Should I be able to use minimal.master?

Update

The content control should say PlaceHolderMain not PlaceHolderMain2

With Custome error mode being off I get the following error:

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 

** Update 2 **

The code line that includes the masterpage now reads

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

This now produces the following error but should mean I am hitting the masterpage

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


The ContentPlaceHolderIDs that you use, must exist in the master page.

The minimal master page has these:

<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" />

So PlaceHolderMain2 will not work (unless you add it to the master page)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜