S
SammyBar
I'm trying to get to work the simplest example on nested master pages. But
I'm receiving the error: "Content controls have to be top-level controls in
a content page or a nested master page that references a master page. "
My pages are the next:
Parent.Master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Parent.master.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.Parent" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="MasterContentPlaceHolder"
runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
--------------------------------------------------------------
Child.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Child.master.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.Child"
MasterPageFile="~/test/Parent.Master" %>
<asp:Content ContentPlaceHolderID="MasterContentPlaceHolder">
<asp:ContentPlaceHolder ID="ChildContentPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
----------------------------------------------------------------
WebForm2.aspx
<%@ Page Language="C#" MasterPageFile="~/test/Child.Master"
AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.WebForm2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ChildContentPlaceHolder"
runat="server">
<p>qwerty</p>
</asp:Content>
It looks like ASP.NET does not like the embedding of ContentPlaceHolder
inside Content, but it is the way the nesting works in all examples I have
been looking. What is wrong?
Thanks in advance
Sammy
I'm receiving the error: "Content controls have to be top-level controls in
a content page or a nested master page that references a master page. "
My pages are the next:
Parent.Master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Parent.master.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.Parent" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="MasterContentPlaceHolder"
runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
--------------------------------------------------------------
Child.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Child.master.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.Child"
MasterPageFile="~/test/Parent.Master" %>
<asp:Content ContentPlaceHolderID="MasterContentPlaceHolder">
<asp:ContentPlaceHolder ID="ChildContentPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
----------------------------------------------------------------
WebForm2.aspx
<%@ Page Language="C#" MasterPageFile="~/test/Child.Master"
AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="mx.com.Matusa.MatusaWeb2.test.WebForm2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ChildContentPlaceHolder"
runat="server">
<p>qwerty</p>
</asp:Content>
It looks like ASP.NET does not like the embedding of ContentPlaceHolder
inside Content, but it is the way the nesting works in all examples I have
been looking. What is wrong?
Thanks in advance
Sammy