Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.)

share|improve this answer
    
Ok, I undestand that it's not possible to do this. I'll consider a new aproach and put the code outside configuration menu.Thanks –  user674887 Aug 23 '11 at 11:07
    
I havent explained clear enough then: you definately can do this, but you need to place all your properties in the toolpane (and hence dont make them [Browsable]. –  Anders Rask Aug 23 '11 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.