Hello,
I have this:
MasterPage 1:
<asp:ContentPla ceHolder ID="cphHead" runat="server">
</asp:ContentPlac eHolder>
Some Html...
<asp:ContentPla ceHolder ID="cphBody1" runat="server">
</asp:ContentPlac eHolder>
MasterPage 2:
<asp:ContentPla ceHolder ID="cphHead" runat="server">
</asp:ContentPlac eHolder>
Some Html...
<asp:ContentPla ceHolder ID="cphBody2" runat="server">
</asp:ContentPlac eHolder>
Page:
<asp:Content ID="Content1" ContentPlaceHol derID="cphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="cphBody1 " runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHol derID="cphBody2 " runat="Server">
</asp:Content>
I need to load different MasterPage based on some factors, when I try to
load MasterPage 1, I get that the page "Content3" control points to an
invalid ContentPlaceHol derID. This error is logical and expected, however,
how can I turn this behaviour so that I don't want to show "Content3" in
case the MasterPage doesn't contain a ContentPlaceHol der for it.
I tried, in the page events, to detect the Content controls and eliminate
those that do not have a ContentPlaceHol der in the masterpage, but I failed
to detect the Content controls and I knew why when I've read:
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
Because the Content controls do not belong to the page!
Please if you have any solution or ideas for this, then hit me with it!
Thank you in advance,
Adam Tibi