home / software / tips and tricks / How to Use nested master page in asp.net?

How to Use nested master page in asp.net?

Updated:  01/26/2011 16:01 PM
Author:  Shiju Mathews

Status:    Resolved.


Master pages can be nested, with one master page referencing another as its master. Nested master pages allow you to create componentized master pages. A site might contain an overall (Root) master page that defines the look of the site. One or more child master page can be inherited from this root master page. This child master page can be used as the master page for different content pages.

Child master page has the file name extension .master, as with any master page. A content page contains content controls that are mapped to content placeholders on the child master page. The child master page contains content controls that are mapped to content placeholders on the Root master page.

How To Create Nested master pages for an asp.net content page?

New Project


Create a project in VS 2010

  • Go to visual studio and click on new project.
  • On the popup window select ASP.NET web application and give a name for ‘Name’ and ‘Location’.
  • Click Add.

    Root Master Page


    Add A Master page

  • On the solution right click on the project and select ‘Add > new item’.
  • Select Master page and type a Name in the ‘Name:’ textbox(CICMaster.Master).

    Add A nested master page



    Nested Master Page
  • Again right click on the solution on the project and select ‘ADD > new item’.
  • Select Nested Master page and type a Name in the ‘Name:’ textbox(CourtesyIndia.Master).
  • ‘Select am master page’ will popup.

    Add A nested master page

  • Select ‘CICMaster.Master’ as root master page.
  • Click Add.

    Content Page


    Add a content page with nested master page

  • Again right click on the solution on the project and select ‘ADD > new item’.
  • Select Web Form using Master page and type a Name in the ‘Name:’ textbox(Home.aspx).
  • ‘Select am master page’ will popup.

    Add a content page with nested master page

  • Select ‘CourtesyIndia.Master’ as master page.
  • Click Add. add some content to Home.aspx, CourtesyIndia.Master, CICMaster.Master and run the project.
  • Tags: How to Use nested master page in asp.net?
    Updated on: November 2024