Using Web Parts

To insert and delete Web Parts in a SharePoint site, you must have either the Add/Remove Personal Web Parts permission or the Add and Customize Pages permission. By default, at least one of these permissions is granted to members of the Designer, Hierarchy Managers, and Home Owner site groups. If you are unable to insert or delete a Web Part or Web Part zone, contact your server administrator. If you add a Web Part in Personal view, remember that no one else will see the modifications that you have made.

Adding a Web Part to a Web Part page

You can quickly add content to a Web Part page by adding one or more Web Parts to a Web Part zone.

Note

Users viewing Web Parts in the browser can customize only those located in a Web Part zone.


Using Web Part zones has several advantages including:

  • Easy customization in the browser: The content on the page can easily be changed by anyone comfortable working in a browser.

  • Grouping and arranging: Using Web Part zones gives you greater control over how your Web Parts are arranged on the page. Also, when you include multiple Web Parts in a single Web Part zone, you can either stack them vertically within the zone or arrange them side by side horizontally.

  • Format and appearance: One of the properties that you can control for all Web Parts in a single Web Part zone is whether they display a title bar only, both a title bar and a border, or neither.

  • Customized access: For each Web Part zone, you can control whether users are allowed to add, delete, resize, and move the Web Parts; change their personal Web Part settings; or change Web Part settings for all users.

To add a Web Part to a Web Part zone, follow these steps:

1.
Navigate to the Web Part page on your SharePoint site where you want to add the Web Part(s). In the Web Part page, click Site Actions and select Edit Page as shown in Figure 5.1.

Figure 5.1. Putting a Web Part page into Edit mode using the Site Actions menu


Notice that the Web Part zones have frames around them to delineate the limits of the zone, as shown in Figure 5.2. In this sample there are two Web Part zones (Left and Right). The Left Web Part zone already contains two Web Parts (Upcoming Tasks, Relevant Documents). The Right Web Part zone contains no Web Parts.

Figure 5.2. A Web Part page with two zones


2.
Click Add a Web Part in the Web Part zone where you want to add the Web Part.

3.
The Add Web Parts dialog box appears with a list of Web Parts that are available for use, as shown in Figure 5.3. There are two ways to add a Web Part to a Web Part zone:

  • Check the box to the left of the Web Part name in the Add Web Parts dialog box and click Add. The Web Part will be added to that Web Part zone.

  • At the bottom of the Add Web Parts dialog box, click Advanced Web Part Gallery and options. The Add Web Parts tool pane appears on the right in Browse mode. In this tool pane, a list of gallery collections appears at the top, as shown in Figure 5.4. You can browse different Web Part galleries by selecting (clicking) the gallery name. A list of available Web Parts that correspond to that gallery appears below in the Web Part List. Note that the task pane displays only ten Web Parts at a time. The total number of available Web Parts in each gallery appears in parentheses to the right.



    Figure 5.3. The Add Web Parts dialog box


    Figure 5.4. Advanced Web Part Gallery and options tool pane


4.
If the gallery has a large number of Web Parts, you may want to filter the Web Part List to make it easier to browse. To filter the Web Part List, click the Filter button and select an option from the drop-down menu, as shown in Figure 5.5.

Figure 5.5. The filtering option on the Web Part menu


5.
After the list of Web Parts appears, scroll through the list by clicking Next until you locate the Web Part you want to add and then select it. You have three options for how to add the Web Part:

  • Validate that the zone where you want to add the Web Part is correct in the Add to drop-down menu. Click the Add button.

  • Click, drag, and release the Web Part name in the Web Part List to the desired area within a Web Part zone. You will see where the Web Part will get added from the insertion point (a green horizontal bar). Note that using this second method, you can drag multiple Web Parts to any of the Web Part zones on the screen.

  • When you release the mouse button, the new Web Part is inserted on the page with the appropriate data inside. Web Parts that display lists might appear empty or blank if the list is empty. You may want to modify or configure Web Parts to get them to appear the way you want.

Closing or deleting a Web Part from a Web Part page

To remove a Web Part from a page, you can either close the Web Part or delete it. If you close the Web Part, it is no longer visible on the page, but it can be re-added to the page from the closed Web Part Gallery, as shown in Figure 5.6, or with SharePoint designer. However, these Web Parts are still validated by SharePoint when the page is accessed, so they can slow a page load if, for example, they are accessing outside resources.

Figure 5.6. The closed Web Part Gallery


Other Web Part Editing Options

After working with SharePoint for a while, you will notice that there are other editing options that help you with configuring your Web Part pages. The following items are tricks we have learned over the years that may help you in customizing your Web Part pages.

  • While you are in Edit mode, you can move Web Parts within a zone or across zones by clicking the title bar of the Web Part and dragging it to a new location in a Web Part zone.

  • You can add the same Web Part multiple times to a Web Part zone. For example, you could have two Announcement Web Parts on the same Web Part page.

  • It is often more precise to drag and drop a Web Part to the location within the Web Part zone where you want the Web Part to appear instead of using the Add Web Part button.

  • You can customize the appearance of the Web Part by clicking the Edit drop-down menu within the Web Part title bar. You can minimize, close, delete, or modify the Web Part. These options are discussed in more detail later.

  • You can click the title bar of the Web Parts task pane to display the Find Web Parts menu. Using the options on this menu, you can search for Web Parts across all available galleries by title or description, or import Web Parts from other locations, as shown in the figure. If you cannot find the Web Part that you want, the administrator of the top-level Web site might have removed it or changed its title. For assistance, contact the administrator of the top-level site.

The search option within the advanced Web Part options menu


If you delete a Web Part, you remove it completely from the page. This cannot be undone; however, in general, when you delete a Web Part from a page, only the Web Part itself is deleted from the page. The associated content and data—in a list or library, for example—is still available, and the Web Part is still available in the gallery and can be added again at any time. Exceptions to this rule include the Content Editor Web Part and any other Web Part that contains static content that was added to the current page only. Such content is permanently deleted if the Web Part is deleted.

Closing a Web Part

You can delete a Web Part from a Web Part zone while in Edit mode. Follow these steps to close a Web Part:

1.
From the Site Actions menu in the top-right corner, choose Edit Page.

2.
Close the Web Part by clicking the X in the upper right of that Web Part or by selecting Close from the edit menu on that Web Part.

3.
Select Exit Edit Mode from the top-right corner to return the page to View mode.

Deleting a Web Part

To remove a Web Part completely from the Web Part page, you can delete the Web Part from a Web Part zone within Edit mode. Follow these steps to delete a Web Part:

1.
From the Site Actions menu in the top-right corner, choose Edit Page.

2.
Delete the Web Part by selecting Delete from the edit menu on that Web Part.

3.
In the dialog box, click OK to confirm your selection.

4.
Select Exit Edit Mode from the top-right corner to return the page to View mode.

Configuring Web Parts

Each Web Part can be configured in Edit mode to modify its appearance on the Web Part page. To modify the Web Part’s properties, click the edit pull-down menu within the Web Part and select Modify Shared Web Part. The properties dialog box for the Web Part appears on the right. The Web Part whose properties are being edited will have a dotted orange line around it.

The properties dialog box contains three or more collapsible sections. In general, three of these—Appearance, Layout, and Advanced—appear for every Web Part. You can expand or collapse the sections by clicking on the + and − to the left of the section name.

Note

You may not see these three Web Part properties for three reasons. First, in order to use the Advanced section in the Web Part tool pane, you must have sufficient permissions on that site. Second, a developer can choose which properties to expose or hide. This could be the explanation for finding that some of the common properties are missing from the tool pane. You may also see additional custom properties not listed in the common set. Third, some permission and property settings may disable or hide Web Part properties.


Modifying the Appearance settings

The Appearance settings control how a Web Part is presented on a page. The section has the following settings, as shown in Figure 5.7

  • Title: Type the text that you want to appear in the Web Part’s title bar.

  • Height: If you want the Web Part always to appear with the same height, regardless of the height of the browser window, select Yes, type a value, and select the unit of measure. Otherwise, select “No. Adjust height to fit zone” radio button option.

  • Width: If you want the Web Part always to appear with the same width, regardless of the width of the browser window, select Yes, type a value, and select the unit of measure. Otherwise, select “No. Adjust width to fit zone” radio button option.

  • Chrome State: You have the option to make the Web Part appear “minimized” when the Web Part first appears (only the title bar will be visible). The user will have to maximize, or expand, the Web Part to see its contents. If you want the Web Part to appear minimized, select Minimized. Otherwise, select Normal. By default, the Chrome State is set to Normal and the entire Web Part appears.

  • Chrome Type: Choose one of the settings in the pull-down menu to modify the frame surrounding the Web Part.

  • Default: Inherits the frame style of the surrounding Web Part zone.

    • None: Neither the title bar nor the border appears around the Web Part.

    • Title and Border: Both the title bar and the border appears around the Web Part.

    • Title Only: Only the title bar (but not the border) appears around the Web Part.

    • Border Only: Only the border (but not the title bar) appears around the Web Part.

Figure 5.7. The Appearance settings on a Web Part


Note

You may not be able to see modifications reflected in the Web Part until you exit Edit mode—even if you click the Apply button.


Modifying the Layout settings

The Layout section controls where the Web Part appears on the page and has the following settings:

  • Hidden: Specifies whether a Web Part is hidden when a user opens the Web Part page. Check this box to make the Web Part hidden. Select the box if you want to process the Web Part on the server but suppress its display. If this check box is selected, the Web Part is visible only when you are designing the page, and it has “(Hidden)” added to the title. Hiding a Web Part is especially useful if you want to use a Web Part to provide data to another Web Part through a Web Part connection but don’t want to display the Web Part to the user. Web Part connections are described in more detail later in this chapter.

  • Direction: Specifies the direction of the text in the Web Part content. For example, Arabic and Hebrew are right-to-left languages; English and most other European languages are left-to-right languages.

  • Zone: Specifies the zone in which the Web Part will be displayed. Use the pull-down menu to select the Web Part zone.

  • Zone Index: Specifies the order in which the Web Part will appear within the Web Part zone. If you enter 1, the Web Part appears at the top of the Web Part zone. If you enter 2, the Web Part appears below the first Web Part, and so on.

Modifying the Appearance section

The Advanced section has the following settings:

  • Allow Minimize: Check this box to allow users to toggle the Web Part between minimized and normal. In general, when you minimize a Web Part, only the Title Bar appears.

  • Allow Close: Check this box to allow users to close the Web Part. This removes the Web Part from the view completely. Closing a Web Part is not the same as hiding it or deleting it from the page. In the browser, a closed Web Part does not appear on the page; it is stored in the Closed Web Parts Gallery, from where you can reopen it. You might opt to close a Web Part for several reasons. For example:

    • You don’t currently want to use a particular Web Part on the page, but you have made customizations to it that you don’t want to have to reconfigure if you decide to add it back to the page later.

    • You may have a Web Part that you want on a page only at certain times. To render the Web Part inactive when it is not wanted, you can close it and then open it when you want it again.

    • If you are creating a custom Web Part that you want to make available to users of a specific page so that they can include it in their personalized views of the page, but you don’t want to make that Web Part available in the larger Web Part Gallery for the whole site, you can add the Web Part to the page in Shared view, configure the Web Part how you want, and then close it.

    • If a Web Part that you are creating or customizing is causing the page to function incorrectly, you can close that Web Part until you fix it.

  • Allow Hide: Specifies whether users can hide the Web Part. This removes the Web Part from the view but still allows it to process on the server.

  • Allow Zone Change: Specifies whether users can move the Web Part to a different zone within the same page. Users can move Web Parts from zone to zone by modifying the Web Part’s Zone or by dragging the Web Part to another Zone.

  • Allow Connections: Specifies whether users can connect the Web Part to another Web Part. Enabling connections between Web Parts allows for one Web Part to interact with another.

  • Allow Editing in Personal View: Specifies whether the Web Part properties can be modified in Personal view.

  • Export Mode: Specifies the level of data that is allowed to be exported for this Web Part.

  • Title URL (As appears in MOSS): Specifies the URL of a file that contains additional information about the Web Part. The file is displayed in a separate browser window when you click the Web Part title.

  • Description: Specifies the ScreenTip that appears when you rest the mouse pointer on the Web Part title or Web Part icon. Also, the value of this property is used when you search for Web Parts with the Search command on the Find Web Parts menu, which appears when you click the title bar of the Web Parts task pane.

  • Help URL: Specifies the location of a file that contains Help information about the Web Part. The Help information appears in a separate browser window when you click the Help command on the Web Part menu.

  • Help Mode: Specifies how a browser displays Help content for a Web Part.

    • Modal: Opens a separate browser window, if the browser has this capability. A user must close the window before returning to the Web page.

    • Modeless: Opens a separate browser window, if the browser has this capability. A user does not have to close the window before returning to the Web page. This is the default value.

    • Navigate: Opens the Web page in the current browser window.

    Note

    Even though ASP.NET Web Parts support this property, default Help topics in Windows SharePoint Services version 3 open only in a separate browser window.


  • Catalog Icon Image URL: Specifies the location of a file that contains an image to be used as the Web Part icon in the Web Part List. The image size must be 16 x 16 pixels.

  • Title Icon Image URL: Specifies the location of a file that contains an image to be used in the Web Part title bar. The image size must be 16 x 16 pixels.

  • Import Error Message: Specifies the message that appears if there is a problem importing the Web Part.

  • Target Audiences: This capability is available if Office SharePoint Server 2007 is installed. Specifies which users and groups will be able to see this Web Part based on their membership and permissions.

Connecting Web Parts

Web Parts can be “connected” to pass data from one Web Part to change the display of another Web Part’s data. Typically, you connect Web Parts together so that actions you perform in one Web Part change the contents of another Web Part.

Connecting sets of data from different data sources often requires programming skills. The SharePoint Web Part infrastructure, however, provides a standardized set of interfaces called connection interfaces that allow Web Parts to exchange information with each other at runtime. Making data connections between Web Parts is straightforward through menu commands.

By connecting Web Parts, you can significantly enhance the user experience. You can present data from two Web Parts in alternate views, perform related calculations between two Web Parts, and filter a Web Part using values from another Web Part—all on one Web Part Page. For example, the List Web Part that is built into Microsoft Windows SharePoint Services can provide (send) a row of data to any other Web Part that can consume (receive) that row, such as a Web Part that implements a form to display the row. Another example is to use one Web Part to enter data about a mortgage payment (loan amount, interest rate, loan term) and then pass that data through a connection to another Mortgage Calculator Web Part to compute the mortgage and display the monthly payment schedule.

Because the Web Part infrastructure provides a standard set of connection interfaces, connectable Web Parts can be developed by entirely different developers or companies to communicate with one another. A Web Part that supports connection interfaces can be connected by an end user with either Microsoft Office SharePoint Designer or a Web browser. This allows end users to build sophisticated combinations of Web Parts through a simple menu-driven user interface.

There are three components of a Web Part connection:

  • Source: The Web Part that provides the data. The data can be lists, rows, cells, or parameter values.

  • Target: The Web Part that acts on the data that it receives.

  • Connection: The definition of the relationship between the target and source and the definition of the action that will take place on the target.

Creating a Web Part connection is a three-step process:

1.
Decide what information or data you want available to Web Parts on the Web Part page.

Usually there are views of list data presented by List View Web Parts already available in the Web Part Gallery that displays data within the site. If you create a new list in the site, you will see it appear in the Web Part Gallery and it will be ready for use on your Web Part page. These lists represent data in a tabular format and make it very easy to refresh and modify data, filter data within the list, change the way the data is sorted, and filter the data. By using the view selector in the tool pane, you can easily change the view of a List Web Part, to work with just the columns you need.

In some cases, the data you want is in an application data source external to your site. There are several approaches you can take to make this external data source available. You could request your site administrator to install a Web Part that is designed to use external data sources, such as the Microsoft Office PivotView Web Part, available from Microsoft Office Web Parts and Components. Alternatively, a Web Part developer could develop a customized Web Part that uses an external data source and that can also connect to other Web Parts.

2.
Add the Web Parts to the Web Part Page.

3.
Connect the Web Parts to get the results you want.

a. From the Site Actions menu in the top-right corner, choose Edit Page.

b. Select the Connections option from the edit Web Part menu on the source Web Part and select the target list from the Provide Row To list, as shown in Figure 5.8. If you do not see the list that you expect to connect to, make sure it is on the page. Some Web Parts do not support Web Part connections, such as page viewer or content editor Web Parts, and the Provide Row To menu item only shows Web Parts that are compatible.

Figure 5.8. The Web Part connections menu


c. Follow the wizard as it walks you through the connection steps. First, choose the column that you will send to the target Web Part to filter. Then select the column that will have that value on the source Web Part.

d. Select Exit Edit Mode from the top-right corner to return the page to View mode.

More detailed options on Web Part connections are available when you modify a Web Part page with SharePoint designer. See Chapter 20 for more information on SharePoint designer.

Note

Not only can you make Web Part connections on the same Web Part page, but you can also make connections between Web Parts on two different Web Part pages in the same top-level site by using a Microsoft Windows SharePoint Services–compatible HTML editor, such as Microsoft Office SharePoint Designer 2007.


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

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