In this fourth article about my own UserControl WebPart I will explain how a WebPart can use its own editor parts. Editor parts are very handy when it comes to customizing / personalizing and categorizing the WebPart. In this blog I will only show you how to add an editor part and how to use it to display some common info about the WebPart.
When implementing a editor part you have to do the following steps.
Step 1 Create a class which inherits from EditorPart
Since I don't use the editor part to edit my WebPart I'm not obligated to add any code to the ApplyChanges (Saves the values in an EditorPart control to the corresponding properties in the associated WebPart control.) and SyncChanges (Retrieves the property values from a WebPart control for its associated EditorPart control.) methods.
When using this WebPart in my test portal it will give the image below.
UserControl in ASP.NET 2.0 Portal using my own UserControl WebPart
As you can see in the image, I now have create my first editor part.
Summary I only showed how to use an editor part, but I didn't show how to customize / personalize a WebPart using this editor part. In the next parts I will create the two other editor parts. One article will be about selecting the user control, the other about displaying properties of it.