Serves as the base class for all Web Parts part controls, which render a modular user interface on a Web Forms page.
See Also: Part Members
The System.Web.UI.WebControls.WebParts.Part class defines properties that are common to all part controls and enable them to have a modular and consistent appearance on a Web page. These common properties include a title, a description, and characteristics of the chrome or frame that surrounds a part control.
The Part.Title property specifies a title for the part control. The Part.Description property is used to summarize the part control's purpose, and appears as a ToolTip in the title bar of the control. The Part.ChromeType property dictates what kind of border is rendered around a part control, while the Part.ChromeState property indicates whether a part control is rendered normally, or minimized. The border of a part control is affected by the properties of the zone that contains it; for example, the WebZone.PartChromeType property affects the frames of all part controls contained in a zone.
One type of part control is the System.Web.UI.WebControls.WebParts.WebPart control, which renders content inside a corresponding zone. Another type is the System.Web.UI.WebControls.WebParts.EditorPart control, which provides user interface (UI) controls used to modify (personalize) individual System.Web.UI.WebControls.WebParts.WebPart controls. A third type of part control is the System.Web.UI.WebControls.WebParts.CatalogPart control, which provides a list of System.Web.UI.WebControls.WebParts.WebPart controls that users can add to or remove from a Web page.
Part controls are contained in zones, all of which derive from the abstract System.Web.UI.WebControls.WebParts.WebZone class. A zone is responsible for organizing the part controls it contains. Each zone also renders UI elements for itself, including a header, a footer, a title bar, and UI elements around each contained part control, such as borders.
While part controls usually reside in zones, it is possible to place a part control outside a zone, if the control is referenced declaratively in the markup of a Web page. If a part control is declared outside a zone on a Web page, the control still works, but loses most of its Web Parts functionality. For example, the control cannot be edited, and cannot be dragged into a zone at run time. It is also helpful to remember that no part control can be dragged from a zone and dropped onto a page outside of a zone at run time.
Some examples of base part types, and their corresponding zone types, are shown in the following table.
The various kinds of part controls that derive from the System.Web.UI.WebControls.WebParts.Part class handle the inherited, UI-oriented properties differently. System.Web.UI.WebControls.WebParts.WebPart controls override several of the inherited UI properties, and mark them with the Personalizable attribute (for details, see the System.Web.UI.WebControls.WebParts.PersonalizableAttribute class documentation), which enables the values of those properties to be saved for future browser sessions, a feature known as personalization. For example, if you programmatically enable a user to update the value of a System.Web.UI.WebControls.WebParts.WebPart control's WebPart.Title property at run time, that value will be personalized (assuming that personalization is enabled, which is the default). Several UI properties that System.Web.UI.WebControls.WebParts.WebPart controls inherit from the System.Web.UI.WebControls.WebParts.Part class, and from the System.Web.UI.WebControls.WebControl class, are handled the same way.
In contrast, other part controls, such as System.Web.UI.WebControls.WebParts.EditorPart and System.Web.UI.WebControls.WebParts.CatalogPart, do not enable the inherited UI properties to be personalized. For this reason, programmatically assigned property values are not saved for future browser sessions. For example, if you programmatically enable a user to update a System.Web.UI.WebControls.WebParts.PropertyGridEditorPart control's PropertyGridEditorPart.Title property at run time, the updated value is lost after the control is closed or the browser session ends.
An easy way to save the values on such inherited UI properties for System.Web.UI.WebControls.WebParts.EditorPart and System.Web.UI.WebControls.WebParts.CatalogPart controls for future browser sessions is to declare the property values in page persistence format. However, this is a static approach and still does not allow users to personalize the property values. As an alternative, if you want to enable programmatic updates to the inherited UI properties so users can personalize them at run time, you can use private, static variables to save the property values. Each time a new instance of an System.Web.UI.WebControls.WebParts.EditorPart or System.Web.UI.WebControls.WebParts.CatalogPart control is created (for example, in the method that handles the control's System.Web.UI.Control.Init event), you can reassign a static variable's value to a corresponding property. Such an approach gives users the ability to personalize the editing UI and catalog UI of a Web Parts application.