Partilhar via


Web Parts Control Set Overview

The ASP.NET Web Parts control set is a group of components that work together to enable you to create Web pages on which end users can modify the appearance and behavior of the user interface (UI) directly from a browser. This overview covers the fundamental aspects of the Web Parts control set, including a description of the most frequently used and essential Web Parts components needed to create a Web Parts page.

Categories of Web Parts Components

The Web Parts control set consists of three fundamental building blocks: personalization capabilities, UI structural components required for using Web Parts UI controls on a page, and the Web Parts UI controls themselves. The following diagram illustrates the relationships among these building blocks in the Web Parts control set.

Web Parts controls hierarchy

Web Parts Architecture

Personalization is the foundation of the Web Parts feature. It enables users to modify--or personalize--the layout, appearance, and behavior of Web Parts controls on a page. The personalized settings are long-lived: they are persisted not just during the current browser session (as with view state), but also in long-term storage, so that a user's settings are saved for future browser sessions as well. Personalization is enabled by default for Web Parts pages. For more details on personalization, see Web Parts Personalization Overview.

The UI structural components rely on personalization and provide the core structure and services needed by all Web Parts controls. One UI structural component required on every Web Parts page is the WebPartManager control. Although never visible, this control has the critical task of coordinating all Web Parts controls on a page. For example, it tracks all the individual Web Parts controls. It manages Web Parts zones (regions that contain Web Parts controls on a page), and which controls are in which zones. It also tracks and controls the different display modes a page can be in, such as browse,connect, edit, or catalog mode, and whether personalization changes apply to all users or to individual users. Finally, it initiates and tracks connections and communication between Web Parts controls.

The second kind of UI structural component is the zone. Zones act as layout managers on a Web Parts page. They contain and organize controls that derive from the Part class (part controls), and provide the ability to do modular page layout in either horizontal or vertical orientation. Zones also offer common and consistent UI elements (such as header and footer style, title, border style, action buttons, and so on) for each control they contain; these common elements are known as the chrome of a control. Several specialized types of zones are used in the different display modes and with various controls. The different types of zones are described in the Web Parts Essential Controls section below.

The Web Parts UI controls, all of which derive from the Part class, comprise the primary UI on a Web Parts page. The Web Parts control set is flexible and inclusive in the options it gives you for creating part controls. In addition to creating your own custom Web Parts controls, you can also use existing ASP.NET server controls, user controls, or custom server controls as Web Parts controls. For more details on the variety of ways in which you can use server controls as Web Parts controls, see ASP.NET Web Parts Overview. The essential controls that are most commonly used for creating Web Parts pages are described in the next section.

Web Parts Essential Controls

The Web Parts control set is extensive, but some controls are essential either because they are required for Web Parts to work, or because they are the controls most frequently used on Web Parts pages. As you begin using Web Parts and creating basic Web Parts pages, it is helpful to be familiar with the essential Web Parts controls described in the following table.

Web Parts control Description

WebPartManager

Manages all Web Parts controls on a page. One (and only one) WebPartManager control is required for every Web Parts page.

CatalogZone

Contains CatalogPart controls. Use this zone to create a catalog of Web Parts controls from which users can select controls to add to a page.

EditorZone

Contains EditorPart controls. Use this zone to enable users to edit and personalize Web Parts controls on a page.

WebPartZone

Contains and provides overall layout for the WebPart controls that compose the main UI of a page. Use this zone whenever you create pages with Web Parts controls. Pages can contain one or more zones.

ConnectionsZone

Contains WebPartConnection controls, and provides a UI for managing connections..

WebPart

(GenericWebPart)

Renders the primary UI; most Web Parts UI controls fall into this category.

For maximum programmatic control, you can create custom Web Parts controls that derive from the base WebPart control.

You can also use existing server controls, user controls, or custom controls as Web Parts controls. Whenever any of these controls are placed in a zone, the WebPartManager control automatically wraps them with GenericWebPart controls at run time so that you can use them with Web Parts functionality.

CatalogPart

Contains a list of available Web Parts controls that users can add to the page.

WebPartConnection

Creates a connection between two Web Parts controls on a page. The connection defines one of the Web Parts controls as a provider (of data), and the other as a consumer.

EditorPart

Serves as the base class for the specialized editor controls.

EditorPart controls

(AppearanceEditorPart, LayoutEditorPart, BehaviorEditorPart, and PropertyGridEditorPart)

Allow users to personalize various aspects of Web Parts UI controls on a page.

See Also

Tasks

Walkthrough: Creating a Web Parts Page in Visual Studio
Walkthrough: Creating a Web Parts Page

Concepts

ASP.NET Web Parts Overview
Web Parts Personalization Overview