Having a "duh" moment trying to implement a new content page
Here's the structure
Master Page
---- Nested Master Page
-------- Nested Master's Content Page
Mark up:
Master Page
<asp:ContentPlaceHolder ID="bodyContent" runat="server">
</asp:ContentPlaceHolder>
Nested Master Page
MasterPageFile="~/Views/Shared/Administrator.Master"
<asp:Content ID="Content2" CotentPlaceHolderID="bodyContent" runat="server">
</asp:Content>
Nested Master's Content Page
MasterPageFile="~/Views/Intervention/InterventionMaster.master"
<asp:Content runat="server" ID="myContent" ContentPlaceHolderID="Content2">
</asp:Content>
Receive error:
Cannot find ContentPlaceHolder 'Content2' in the master page '/Views/Intervention/InterventionMaster.master', verify content control's ContentPlaceHolderID attribute in the content page.
What could I be doing wrong?
You don't have ContentPlaceHolder
with ID = "Content2"
. You have only content with such ID. Put another placeholder inside of content with ID="Content2"
and then connect with the page content.
Master Page
<asp:ContentPlaceHolder ID="bodyContent" runat="server">
</asp:ContentPlaceHolder>
Nested Master Page
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContent" runat="server">
<asp:ContentPlaceHolder ID="nestedContent" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
Nested Master's Content Page
<asp:Content runat="server" ID="myContent" ContentPlaceHolderID="nestedContent">
</asp:Content>
A dirty-quick solution would be to bypass the Nested Master Page from the Nested Master's Content Page
protected void Page_PreInit(object sender, EventArgs e)
{
Master.MasterPageFile = "~/Whatever.Master";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With