Click here to Skip to main content
15,887,856 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Help Me creating a nested master page using asp.net 2.0 using c#.
Posted

1 solution

This would help you, you shouls use two master pages, like name first master page Paren.master, name second master page Child.master.
Parent.master file:
XML
<%@ Master Language="C#" %>
<HTML>
   <BODY>
          ----------Some Tags---------
          <asp:ContentPlaceHolder ID="MainContent"
              runat="server" />
           ----------Some Tags---------
</BODY>
</HTML>


Child.master file:
XML
<%@ Master Language="C#" MasterPageFile="Parent.master"%>
<asp:Content id="Content1" ContentPlaceholderID="MainContent"    runat="server">
--------------Some Tags--------
<asp:ContentPlaceHolder ID= "ChildContent" runat="server" />
--------------Some Tags----------
<asp:ContentPlaceHolder ID="ChildFooter" runat="server" />
        -----------Some Tags------------
</asp:Content>


Now just make a content page name child.aspx, give it the MasterPageFile=Child.master.
Child.aspx file:
XML
<%@ Page Language="C#" MasterPageFile="Child.Master"%>
<asp:Content id="pageContent" ContentPlaceholderID="ChildContent" runat="server">
----------Some Tags---------
</asp:Content>
<asp:Content id="footerContent" ContentPlaceholderID="ChildFooter" runat=server>
----------Some Tags---------
</asp:Content>
 
Share this answer
 
Comments
Bhavna v 28-Mar-11 0:28am    
Thank you, This would help me a lot
Bhavna v 28-Mar-11 23:57pm    
Could you please give a little bit explanation about <asp:content

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900