The EditorPart class provides a base set of properties and methods that are used by the derived EditorPart controls provided with the Web Parts control set, and by custom EditorPart controls. An EditorPart control allows a user to edit an associated WebPart control by modifying its layout, appearance, properties, behavior, or other characteristics.
The editing user interface (UI), which consists of EditorZoneBase zones that contain EditorPart controls, is displayed after a Web page enters edit mode.
Note |
|---|
| An EditorPart control can be used only within a zone that derives from the EditorZoneBase class, such as the EditorZone control. |
After a page has entered edit mode, a user can select a WebPart control to edit by clicking an edit verb on the verbs menu of the selected control. Only one WebPart control can be edited at a time.
Several derived EditorPart controls are provided with the Web Parts control set, as listed in the following table. These controls provide all the editing capabilities that are necessary for most applications. The typical approach for using these controls in a Web Parts page is to declare them in page persistence format within a <zonetemplate> element, where <zonetemplate> is the child element of an <asp:editorzone> element. For a code example, see the Example section of this topic.
| Type of control | Description |
| AppearanceEditorPart | Edits the appearance of the associated control, including properties such as its title text, height, width, and border attributes. |
| BehaviorEditorPart | Edits certain behaviors of the associated control, such as whether it can be edited, whether it can be closed, or whether it can be moved to another zone. This control is only visible on a page when a control is being edited in shared personalization scope. |
| LayoutEditorPart | Edits layout attributes for the associated control, such as whether it is in a normal or minimized (collapsed) state, and what zone it is placed in. |
| PropertyGridEditorPart | Edits properties of the associated control, if those properties were declared in the source code with a WebBrowsable attribute. |
Note |
|---|
| To improve accessibility, all the EditorPart controls provided in the Web Parts control set are rendered within a <fieldset> element. The <fieldset> element groups the related set of controls used for editing in a given EditorPart control, and it facilitates tabbed navigation among those controls for both visual user agents (such as ordinary Web browsers) and speech-oriented user agents (such as screen-reading software). |
Notes to Inheritors
To create a custom
EditorPart control, you must override two important methods. The
ApplyChanges method applies changes made in the editor control to the
WebPart control being edited. The
SyncChanges method gets the current values of the
WebPart control being edited, so that the editor control can edit them. Using these two critical methods, you get and set values between your custom
EditorPart control and the
WebPart control it is editing.
If you derive from the
EditorPart class to create custom editor controls, you can add your custom controls to an
EditorZoneBase zone by implementing the
IWebEditable interface in a
WebPart control, a user control, or a server control. For more details and a code example, see the
IWebEditable class overview. Also, the code example in the Example section demonstrates how to implement
IWebEditable in a custom
WebPart control.