IWebEditable.CreateEditorParts Method
Assembly: System.Web (in system.web.dll)
The CreateEditorParts method enables you to create a collection of all the custom EditorPart controls associated with your custom control, WebPart control, or user control, and return them as an EditorPartCollection object. The WebPartManager control takes the collection and creates instances of all the EditorPart controls whenever the server control enters edit mode.
Typically you implement this method in a custom WebPart control by overriding its CreateEditorParts method. In the method, you create instances of the custom EditorPart controls you want to associate with your controls, add them to an EditorPartCollection object, and then return that object. The collection of EditorPart controls is then assigned to the EditorParts property of the EditorZoneBase zone.
Note |
|---|
| Any EditorPart that is added to the collection of EditorPart controls in an implementation of the CreateEditorParts method must have a value assigned to its ID property, otherwise an exception will be thrown when the collection is assigned to the EditorParts property. |
The following code example demonstrates an override of the CreateEditorParts method in a custom WebPart control. The complete source code required to run the sample is found in the Example section of the IWebEditable class overview topic.
The code example contains both members of the IWebEditable interface. Note that the override of the CreateEditorParts method creates an ArrayList to collect one or more custom EditorPart controls, and then uses the list to create the EditorPartCollection object.
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note