Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. nested master page problem

nested master page problem

Scheduled Pinned Locked Moved ASP.NET
csharphelphtmlasp-netsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arif Liminto
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • A Arif Liminto

      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

      J Offline
      J Offline
      josh417
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups