Search code examples
asp.netsharepointsharepoint-2013master-pages

How to set a page layout to a different master page?


If there are two master pages on a site. How can I set a second set of page layouts to draw from the second master page rather than the default master page for the site?

I've seen the MasterPageFile="" suggestion, however, I received a file not found, although the path/file exists (~/_catalogs/masterpage/MyMaster.master).

Secondly, is it possible to do this purely through SharePoint Designer?


Solution

  • The master page resides in the gallery at the site collection level.

    So, you should modify the MasterPageFile attribute as below:

    <%@ Page language="C#" MasterPageFile="/_catalogs/masterpage/custom2.master"
    

    or using the ~ operator as below:

    <%@ Page language="C#" MasterPageFile="~sitecollection/_catalogs/masterpage/custom2.master"