How to order Web Part properties
I was wondering if there is a way to order the web part properties with the web part has no custom ToolPart associated with it. There is a simple solution for this: just override the GetToolParts() method of the web part and add the tool parts in the desired order. There are some default ToolPart objects we have to add here.
- WebPartToolPart is responsible for rendering the default properties in the categories, Appearance, Layout and Advanced
- CustomPropertyToolPart is responsible for adding the browsable properties defined within the web part
Here is the code which does this:
public override ToolPart[] GetToolParts()
{
ToolPart[] toolparts = new ToolPart[2];
WebPartToolPart defaultToolPart = new WebPartToolPart();
CustomPropertyToolPart browsableProperties = new CustomPropertyToolPart();toolparts[0] = browsableProperties;
toolparts[1] = defaultToolPart;
return toolparts;
}
No comments yet.
-
Archives
- March 2010 (2)
- February 2010 (1)
- May 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS
Leave a comment