Provides an editor control that enables end users to edit several user interface (UI) properties on an associated WebPart control. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
Just as there are tool-oriented zones in the Web Parts control set (for details, see the ToolZone class overview), there are tool-oriented part controls (tool parts), and each tool part must reside in a certain type of tool zone. Tool parts in the Web Parts control set have two distinguishing characteristics:
They are helper controls that enable end users to personalize controls on a Web Parts page.
They are visible only in certain display modes.
The control is a tool part that becomes visible only when a Web Parts page is in edit mode, and when a specific WebPart control has been selected for editing. The control, like all other EditorPart controls, resides in an EditorZone control.
The control is not displayed on the page under certain conditions. If the IsShared property value on the WebPart control being edited is true, and the page is in user personalization scope (which is the default), the control is not displayed. For the control to be displayed in this scenario, typically you would need to follow two steps:
Add an entry to the Web.config file that gives an authorized user permission to edit Web pages in shared personalization scope (which means that the changes the user makes will be visible to all users of the application).
Programmatically change the page from user-level to shared-level personalization scope at run time, for example by using the ToggleScope method.
For an example of how to make the control visible in a page, see the Example section of this topic. For more information about shared controls and personalization scope, see Web Parts Personalization Overview.
The class also has an important method, SyncChanges, which it inherits from the EditorPart class and overrides. The method is critical because it enables getting the property values from the WebPart control being edited and assigning them to the fields of the editing control.
In most cases, the control should be used in page persistence format by declaring an <asp:behavioreditorpart> element inside a <zonetemplate> element, which is in turn contained by an <asp:editorzone> element on a Web page. The control enables end users to edit the following UI properties of a WebPart control:
To edit other properties and behavior of WebPart controls, you can use the other EditorPart controls supplied with the Web Parts control set. These controls include the LayoutEditorPart, the AppearanceEditorPart, and the PropertyGridEditorPart control. The supplied EditorPart controls should provide most editing features required to edit WebPart controls, but you can also create a custom editor control by inheriting from the EditorPart class. For a code example, see the EditorPart class overview.
To improve accessibility, the control is rendered within a <fieldset> element. The <fieldset> element groups the related set of controls used for editing in the 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).
The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.
The following code example demonstrates how to declare a control on a Web page, and enable it to edit several UI properties of a WebPart control. The code example has four parts:
A user control that enables you to change display modes on a Web Parts page.
An entry to make in the Web.config file to give an authorized user permission to edit the page in shared personalization scope.
An explanation of how the example works when you load the page in a browser.
The first part of this code example is the user control that enables users to change display modes on a Web page. For details about display modes and a description of the source code in this control, see Walkthrough: Changing Display Modes on a Web Parts Page. The documentation for this user control explains how to call the ToggleScope method to switch the page into shared mode, which enables the control to appear.
The second part of the code example is the Web page. It contains a declarative reference to an EditorZone control, with a child <zonetemplate> element that contains declarative references to a control. Note that the page also contains a BulletedList control that is bound to the Pubs database; because this control resides in a WebPartZone, it is able to function as a WebPart control that can be edited by the control.
This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.
The third part of the example is an entry in the Web.config file. You must make an entry like the following in the <webParts> section of the file, to enable an authorized user or set of users to edit the Web page when it is in shared personalization scope. This entry is a critical step; otherwise, the control will not be visible when you switch the page into edit mode.
<allow users="User_account" roles="admin"
When you load the page in a browser, you can first select the Shared option on the Display Mode drop-down list control. Next, click the drop-down list itself, and select Edit Mode to switch the page into edit mode. You can click the verbs menu (the downward arrow) in the title bar of the Author List WebPart control, and click Edit to begin editing. When the editing UI is visible, you can see the control, and a button and text box positioned above it. If you make some changes in the editing UI and click the Apply button, you can use the Display Mode drop-down list control to return the page to browse mode and see the full effect of the editing changes.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.