Creating and Modifying Web Pages in Microsoft SharePoint Designer 2010

  • 12/23/2010

Creating an ASP.NET Page

The page you see in your browser when you request a page from a SharePoint site is the combination of two Microsoft ASP.NET pages: a master page and a content page.

httpatomoreillycomsourcemspimages1806299.jpg

A master page is a special ASP.NET 2.0 page that you can use to share code between pages. It provides a site with a consistent appearance and navigation for each page within a site. You cannot view a master page in your browser, but you can view and customize a master page by using SharePoint Designer.

When you open a content page in Design view, the merged view of the two pages is displayed. In this view, even in advanced edit mode, you can only edit the code that the content page contains. The no-entry icon is displayed if you point to code that the master page contains. In Code view for a content page, you see only the code that the content page contains. An example of a content page is the home page of a team site, which is named Home.aspx.

When you use a browser to request a page from a SharePoint Server publishing site, it can be a combination of three ASP.NET pages: a master page, a page layout, and a content page. (In this scenario, the content page is referred to as a publishing page.) On the other hand, when you request a page from, say, a team site or a document workspace, two ASP.NET pages are combined: a master page and a content page. (In this scenario, the content page is referred to as a nonpublishing page.) You cannot modify a publishing content page by using SharePoint Designer; you must use the browser. However, you can modify the master page and page layout by using SharePoint Designer.

If you want to create a Web page in SharePoint Designer, you could copy an existing page, as you did earlier in this chapter. Otherwise, you need to create an ASP.NET page, associate a master page, and then insert Web Part zones (thereby creating a Web Part page) or insert the controls that make the page a Wiki page.

All built-in Web Part pages and Wiki pages use tables, but if you are concerned about accessibility, you may want to use HTML <div> tags to lay out the pages you create from scratch. Because you can insert more than one Web Part per Web Part zone, it is common practice to insert one Web Part zone to a table cell or <div> tag.

In this exercise, you create an ASP.NET page.

  1. In the Navigation pane, click Site Pages. On the Pages tab, click Page and then click ASPX.

    A file, Untitled-1.aspx, is created and displayed in the Site Pages gallery page. Untitled_1.aspx is selected.

  2. Type OfficeFurniture.aspx, and then press Enter to rename the page.

  3. httpatomoreillycomsourcemspimages1806033.jpg On the Pages tab, click Edit File.

    A dialog box opens, warning that the page does not contain any regions that are editable in safe mode.

    httpatomoreillycomsourcemspimages1806301.jpg
  4. Click Yes to open OfficeFurniture.aspx page in advanced mode.

    A blue-bordered rectangle with the label form#form1 is displayed in Design view.

  5. httpatomoreillycomsourcemspimages1806303.jpg On the workspace status bar, click Split.

    In Code view of the page, the HTML <head> and <body> tags are surrounded by <html> tags. The <body> tags contain <form> tags.