SharePoint Page Layouts and Master Pages (ECM)
Published: May 2010
Publishing in Microsoft SharePoint Server 2010 is fundamentally a means of authoring and displaying information by using a set of templates. With regard to publishing in SharePoint Server 2010, there are two fundamental templates to understand: master pages and page layouts.
Master pages and page layouts dictate the overall look and feel of your SharePoint site. Master pages contain controls that are shared across multiple page layouts, such as navigation, search, or language-preference for multilingual sites. Page layouts contain field controls and Web Parts
By using master pages, you can provide a consistent look and feel for your site. You can use master pages to position items that must be shared by all pages, such as navigational controls, company logos, and copyright notices. Within master pages, you can use user controls (.ascx controls), Web server controls, and Web Parts.
The top-level SharePoint Server site for a site collection hosted on SharePoint Server 2010 has a special document library called the Master Page and Page Layout Gallery. All page layouts and master pages are stored in this document library. The Master Page and Page Layout Gallery supports versioning and workflow, so you can use those features for your master pages and page layouts.
By default, SharePoint Server 2010 creates a master page gallery for every site; however, you can create only new pages with the page layouts stored in the master page gallery of the top-level site in the site collection.
All page layouts reference a master page that is based on the CustomMasterUrl property of the SPWeb class. All page layouts host controls called field controls that bind to fields on the master page list item. You can use the default controls or build custom controls. Field controls enable content to be edited and rendered for display. To see a code example for creating and using a custom field control, see How to: Create a Custom Field Control.
Page layouts can be used by all page instances that are based on that page layout. Master pages can be used by all page instances in a site. Page instances based on the same page layout in different sites can use different master pages.
For more information about master pages, see the ASP.NET Developer Center.