Question

In a Webpart I have some customs properties. For the strings, booleans and enums, is all ok, but I have a problem with the selects (comboboxes).

To use a select I needed to create a Toolpart that contains it. And then I added this toolpart this way:

public override ToolPart[] GetToolParts()
        {
            ToolPart[] toolparts = new ToolPart[3];
            WebPartToolPart wptp = new WebPartToolPart();
            CustomPropertyToolPart custom = new CustomPropertyToolPart();
            toolparts[0] = wptp;
            toolparts[1] = custom;
            toolparts[2] = new SelectToolPart(); // MY NEW TOOLPART   

            return toolparts;
        }

But I want that this select appears inside the custom menu (like the other "normal" options).

Better I add a image that I think is easy to understand:

http://imageshack.us/photo/my-images/824/capturastack.png/

How can I do this?

Was it helpful?

Solution

Since you use more complex data types, the toolpart manager cannot convert the data type to a field in the toolpart (as you do)

When you add your custom toolpart this will inevitable be placed over or under your OOB toolpart (you handle where in your toolParts array).

However if you add your other "simple data type" custom properties to the toolpart as well, you should be able to achieve what you want.

NOTE: it is considered a best practice for SP2010 to prefer ASP.NET WebParts over SharePoint web parts (and hence EditorParts over ToolParts) unless there is a good reason not to.)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top