I would like to have a page that uses the main page for children, fill in the placeholder for the contents of the parent, but I cannot get it to work. Whenever I try, I get the error "I can not find" CustomHead "ContentPlaceHolder on the main page" /templates/info.master ", check the contents of the ContentPlaceHolderID on the content page."
I have a main page (/templates/main.master) defined as follows:
<% @Master Language = "#" % > < head runat = "server" > < & GT; Foo </& GT; < asp: contentplaceholder runat = "server" id = "customHead" /> </ > & ; > < div id = "content" > < asp: contentplaceholder runat = "server" id = "masterContent" /> </ > >
Then I have a child wizard (/templates/info.master), which is defined as follows:
<%@ Master Language="C#" MasterPageFile="/templates/main.master" %> <asp:content id="homeContent" contentPlaceHolderId="masterContent" Runat="server"> <div id="info-container"> <div id="info-content"> <asp:contentplaceholder runat="server" id="infoContent"/> </div> </div> </asp:content>
And finally, my page is defined as follows:
<% @Page Language = "#" MasterPageFile = "/templates/info.master" % > < asp: Content ID = "head" ContentPlaceHolderID = "customHead" runat = "server" > <! - - > < link rel= "stylesheet" type = "text/css" href= "foo.css" /> </: > < asp: Content ID = "content" ContentPlaceHolderID = "childContent" runat = "server" > </: > >
source share