SharePoint Explored

Just another weblog

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:

override ToolPart[] GetToolParts()

ToolPart[] toolparts = new ToolPart[2];
WebPartToolPart defaultToolPart = new WebPartToolPart();
CustomPropertyToolPart browsableProperties = new CustomPropertyToolPart();

toolparts[0] = browsableProperties;
toolparts[1] = defaultToolPart;

return toolparts;


February 2, 2010 - Posted by | SharePoint Hack

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: