Home > Sample chapters

Creating and Modifying Web Pages in Microsoft SharePoint Designer 2010

Attaching a Master Page

In the previous exercises, you created an ASP.NET page and added a Web Part zone to it, but it did not contain any SharePoint site navigation nor did it inherit any look and feel from the SharePoint site. You can envision the page you created as just the content page. It is not associated with a master page, which is the page that defines the common user interface and code. To attach a master page or to change a master page that a content page is associated with, you must open the page in advanced mode.

Each site has one master page configured as the site’s master page, referred to by using the token ~masterurl/default.master, and then all pages associated with the site’s master page inherit the same look and feel. When a site is created, all pages created for the site point to the site’s master page by using this token. With SharePoint Designer, you can change the master page attached to a page. If a page is not attached to a master page, you can attach the page to the site’s master page or attach the page to a specific master page, such as v4.master.

In this exercise, you attach a page to the site’s master page.

  1. httpatomoreillycomsourcemspimages1806313.jpg On the Style tab, click Attach in the Master Page group, and then click More Options.

    httpatomoreillycomsourcemspimages1806315.jpg

    The Select A Master Page dialog box opens.

  2. In the Select a Master Page dialog box, select Default Master Page (~masterurl/default.master) if the option is not already selected.

    httpatomoreillycomsourcemspimages1806317.jpg
  3. Click OK.

    The Match Content Regions dialog box opens.

    httpatomoreillycomsourcemspimages1806319.jpg
  4. Click OK to accept the default setting of associating all the code within the HTML <body> tags of the current page, OfficeFurniture.aspx, to the content region, PlaceHolderMain on the master page.

    SharePoint Designer redisplays OfficeFurniture.aspx, which now has a SharePoint look and feel. The HTML <html>, <head>, <body>, and <form> tags are removed from the content page because they are defined in the master page.

    httpatomoreillycomsourcemspimages1806321.jpg
  5. httpatomoreillycomsourcemspimages1806059.jpg On the Quick Access Toolbar, click Save, and then press F12 to review the page in the browser.