Hi,
I created a Application page and then trying to set a custom Master page.
The Master page is available in the Master page gallery of the subsite.
I have the UI as below:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewPage.aspx.cs" Inherits="Test.ViewPage" DynamicMasterPageFile="~masterurl/default.master" %><asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server"></asp:Content><asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"><div style="font-family: Calibri; color: #000000; font-size: 10pt;"><table style="width: 100%;"> //table contents</table></div></asp:Content><asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server"> Some Title</asp:Content><asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server"></asp:Content>
In the CS code:
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); string strUrl = "subsiteUrl/" + "_catalogs/masterpage/Test.master"; this.MasterPageFile = strUrl; }
I am getting the error as "System.Web.HttpException: Content controls are allowed only in content page that references a master page.
at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
at System.Web.UI.Page.ApplyMasterPage() "
In the Custom Master page, I have verified that the ConentTemplateId's exist.
There is no commented data inside the table. I have used only controls like div, table, tr, td. Some of the TD have data like this:
<td> </td>
How to fix this?
Thanks