GetToolParts Method

The GetToolParts method of the WebPart base class determines which tool parts are displayed in the tool pane of the Web-based Web Part design user interface, and the order in which they are displayed.

Return Value

An array of type ToolPart that determines which tool parts will be displayed in the tool pane. If a Web Part that implements one or more custom properties does not override the GetToolParts method, the base class method will return an instance of the WebPartToolPart class and an instance of the CustomPropertyToolPart class. An instance of the WebPartToolPart class displays a tool part for working with the properties provided by the WebPart base class. An instance of the CustomPropertyToolPart class displays a built-in tool part for working custom Web Part properties, as long as the custom property is of one of the types supported by that tool part. The supported types are: String, Boolean, Integer, DateTime, or Enum.

Remarks

When creating a custom Web Part that includes custom properties that require a custom tool part (an implementation of the ToolPart class) , you must override the GetToolParts method to specify the list of custom tool parts in that are rendered inside the tool pane. For more information, see Creating a Web Part with a Custom Tool Part

Example

The following code example shows an overridden GetToolParts method. This code example is part of a larger example provided in the Creating a Web Part with a Custom Tool Part programming task.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security