Chapter 11. Using SharePoint Web Parts and Controls

IN THIS CHAPTER

Understanding SharePoint Web parts

Inserting Web parts and Web part zones

Exploiting SharePoint controls

Earlier in this book, I introduced some basic concepts about SharePoint sites. I talked about the interface and layout of a SharePoint site as well as how to create SharePoint sites, site collections, and Web pages. I showed how you can use SharePoint Designer to create Web pages for SharePoint sites. You were also given a quick overview of what a SharePoint Web part is. Now that you have been exposed to SharePoint Designer for creating non-SharePoint content, I want to revisit SharePoint to offer more details about the components of a SharePoint site and how they interact with SharePoint Designer.

In this chapter, I introduce you to some key concepts about SharePoint that readily apply when you work with SharePoint Designer on SharePoint sites. I discuss concepts such as ghosting and un-ghosting of SharePoint content, take you through the user interface provided by SharePoint and SharePoint Designer for working with SharePoint Web parts and controls, and mention the commonly used SharePoint Web parts and controls. I familiarize you with SharePoint Web part galleries and discuss how you can add Web parts to these galleries for use in SharePoint sites. You also become familiar with the concept of Web part zones and how you can use SharePoint Designer to insert Web part zones on custom pages to facilitate easier interaction with Web parts on SharePoint sites.

To start, you must know that every SharePoint site or site collection is based on a site definition. At creation, based on the site template chosen for the site, SharePoint reads the site definition files from its file system location and uses it to define the look and feel, features, and functionality that are applied and made available for the site being created. As with most SharePoint files, you can create new site definitions or modify existing ones to define how the site should behave and what features should be made available to it. Site definitions are installed on the machine running SharePoint at installation time and are stored at C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATESiteTemplates. In fact, the TEMPLATE folder hosts most of the SharePoint definition files, templates, layouts, CSS and JavaScript files, themes, etc.

Every SharePoint Web application has virtual directories created in it that point to various folders in the TEMPLATE folder. For example, the layouts virtual directory created at Web application creation points to the C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATELAYOUTS folder and hosts most of the SharePoint settings for Web pages, master pages, JavaScript files, images, etc.

When a SharePoint Web page is requested for display in a browser, SharePoint combines the file system copy of the Web page and the data retrieved from the SharePoint databases to show the final Web page to the user. The file system copy may be common to multiple SharePoint pages. This ghosted approach used for displaying Web pages is the default behavior followed by SharePoint to render all pages inside the Web site. However, this approach changes after the Web page has been modified and saved by SharePoint Designer.

After you modify a Web page using SharePoint Designer, the Web page becomes completely stored in the SharePoint database. The process that un-ghosts the Web page is important for SharePoint Designer to be able to make persistent changes and allow for remote authoring of the Web pages. When the Web page is un-ghosted, the file system copy is no longer used, and the page is directly retrieved from the database for display.

While previous versions of SharePoint didn't allow for an option to re-ghost the Web pages so that they fall back to the default behavior, WSS v3 and MOSS sites allow you to re-ghost the Web pages by using a process called Reset to Site Definition. When you edit and save a SharePoint Web page, such as default.aspx, in SharePoint Designer, a warning pops up, as shown in Figure 11.1.

Figure 11.1. Un-ghosting Web pages using SharePoint Designer

After you click Yes in the Site Definition Page Warning dialog box, a blue icon appears next to the modified page in the SharePoint Designer Folder List task pane, as shown in Figure 11.2. If you hover over the Web page in the Folder List task pane, a screen tip shows that the page has been customized.

Figure 11.2. The Folder List task pane displays a blue icon next to a modified Web page.

When you right-click in the Web page, the popup menu shows a Reset to Site Definition option. This allows you to reset the Web page back to the default SharePoint behavior of ghosting by using the site definition files.

Resetting a Web page back to site definition means that you lose all customizations that you made to the Web page via SharePoint Designer. SharePoint falls back to the default ghosting behavior.


If you have a large number of SharePoint Web pages that have been customized by using SharePoint Designer, you can use the master Reset to site definition link on the SharePoint Site Settings Web page, as shown in Figure 11.3.

Clicking on the link opens the layouts/reghost.aspx Web page, which allows you to either specify a URL of the Web page that you want to re-ghost or reset all pages in the site-to-site definition.

Web pages created from scratch by using SharePoint Designer are always stored in the SharePoint database and can't be ghosted. So, you won't find the Reset to site definition link on such Web pages.

Figure 11.3. Use the Reset to site definition link on the Site Settings Web page to reset all customized pages to the default site definition.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.167.86