nested master page problem
-
Hi, I am still a newbie in ASP.net development, I try to learn about nested master page, and I got this problem Cannot find ContentPlaceHolder 'ContentPlaceHolderUser' in the master page '/OnlinePrayer/MasterPage/AdminUser.master' I have done some research in internet, but until now, I have not got the right solutions. basically, in my website, there are 2 master page : AdminUser.master and User.master and AdminUser is child of User, In User.Master , I've got this following code
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="User.master.cs" Inherits="MasterPage_User" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>UserPage</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolderUser" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>and in AdminUser.master, i've got this code
<%@ Master Language="C#" MasterPageFile="~/MasterPage/User.master" AutoEventWireup="true" CodeFile="AdminUser.master.cs" Inherits="MasterPage_AdminUser" %>
<asp:Content ID= "SubContent1" contentplaceholderid="ContentPlaceHolderUser" runat="server">
</asp:Content>I thought that I had define ContentPlaceHolderUser in User.Master, but I dunno why I still got this error? in Admin.Master I would be grateful if you could give me feedbacks about my problems, thanks
-
Hi, I am still a newbie in ASP.net development, I try to learn about nested master page, and I got this problem Cannot find ContentPlaceHolder 'ContentPlaceHolderUser' in the master page '/OnlinePrayer/MasterPage/AdminUser.master' I have done some research in internet, but until now, I have not got the right solutions. basically, in my website, there are 2 master page : AdminUser.master and User.master and AdminUser is child of User, In User.Master , I've got this following code
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="User.master.cs" Inherits="MasterPage_User" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>UserPage</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolderUser" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>and in AdminUser.master, i've got this code
<%@ Master Language="C#" MasterPageFile="~/MasterPage/User.master" AutoEventWireup="true" CodeFile="AdminUser.master.cs" Inherits="MasterPage_AdminUser" %>
<asp:Content ID= "SubContent1" contentplaceholderid="ContentPlaceHolderUser" runat="server">
</asp:Content>I thought that I had define ContentPlaceHolderUser in User.Master, but I dunno why I still got this error? in Admin.Master I would be grateful if you could give me feedbacks about my problems, thanks
Hi,I hope I understand your problem in a correct way. Here iam giving you the code for two nested master pages and an aspx page which uses these master pages. try it out. 1.User.master as follows. Title
Some content in main master page
runat="server"> Child master page will be placed here...
2.AdminUser.Master as follows(child master page for User as you said and here the Master page file is User.Master). ContentPlaceHolderID="ContentPlaceHolder1">
This is child master page
runat="server" EnableViewState="true"> Contents of pages...
Content in Child master page.
runat="server" EnableViewState="true"> Contents of pages.3.Default.aspx page which uses the master page.(Master Page file is AdminUser.Master) ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
Some content on page
Some content on page
ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
Some content on page