Authors

Apr 16 Exam 70-553 - Implement Web Parts in a Web application.

Track and coordinate all Web Parts controls on a page by adding a WebPartManager control.

Connect Web Parts to each other by using connection objects.

Divide a page that uses Web Parts into zones by using WebPartZones.

Present a list of available Web Parts controls to users by using CatalogPart controls.

Enable users to edit and personalize Web Parts controls on a page by using EditorPart controls.

Summary

New to ASP.Net 2.0 are the concept of web parts, customizable modular data presentation components.

The WebPartManager Class is used to manage all the Web Parts on a page and their events. This class is the workhorse for all web part functionality. The following details on what this control does is taken from MSDN:

The WebPartManager control acts as the hub or control center of a Web Parts application. There must be one--and only one--WebPartManager control instance on every page that uses Web Parts controls. As with most aspects of Web Parts applications, the WebPartManager control works only with authenticated users. Further, its functionality works almost entirely with server controls that reside within Web Parts zones that inherit from the WebZone class. Server controls that reside on a page outside of these zones can have very little Web Parts functionality or interaction with the WebPartManager control.

As the hub for Web Parts functionality on a page, the WebPartManager control carries out the kinds of tasks listed below

Tracking Web Parts controlsKeeps track of the many different kinds of controls on a page that provide Web Parts features, including WebPart controls, connections, zones, and others.

Adding and removing Web Parts controlsProvides the methods for adding, deleting, and closing WebPart controls on a page.

Administering connectionsCreates connections between controls, and monitors the connections as well as the processes of adding and removing them.

Personalizing controls and pagesEnables users to move controls to different locations on a page, and launches the views in which users can edit the appearance, properties, and behavior of controls. Maintains user-specific personalization settings on each page.

Toggling between different page viewsSwitches a page among different specialized views of the page, so that users can carry out certain tasks such as changing page layout or editing controls.

Raising Web Parts life-cycle eventsDefines, raises, and enables developers to handle life-cycle events of Web Parts controls, such as when controls are being added, moved, connected, or deleted.

Enabling import and export of controlsExports XML streams that contain the state of the properties of WebPart controls, and allows users to import the files for convenience in personalizing complex controls in other pages or sites.

The following explanation of connecting Web Parts comes from the Personalizing Using Web Parts ASP.Net Quickstart Tutorial:

Web parts are also capable of exchanging data between them, using web part connections. Using connections, you can have one web part provide one or more property values that can be used by other web parts on the page. Web part connections have the following elements:

An interface that defines the communications contract between two parts. The interface describes properties and methods available through the connection.

A web part that behaves as a connection provider. To specify a provider connection point, a web part needs to have a method that creates and returns an instance of the communications interface. This method should be marked with the ConnectionProvider attribute. By default, A single provider connection point can be used with multiple connection consumers.

A web part that behaves as a connection consumer. To specify a consumer connection point, a web part needs to have a method that takes an instance of the communications interface as a parameter. This method should be marked with the ConnectionConsumer attribute. By default, A single consumer connection point can only be used with one connection provider.

WebPartZones define the areas on the page where Web Parts can be placed and also define common user interface for those controls by defining styles.

The CatalogPart Control is used to list the controls that a user can add to a web page.

The EditorPart Control is used to modify web parts when they are in edit mode. Using this control you can modify its layout, appearance, properties, behavior, or other characteristics.