3

I wish to provide option to Select multiple option in my webpart Properties. Below code only allows me to Select one option. How to Select multiple options?

Private colorPicked As MyColors
Public Enum MyColors
Red = 0
Blue = 1
Green = 2
End Enum

<Browsable(True), Category("Select Color"), DefaultValue(""), _WebPartStorage(Storage.Shared), FriendlyName("Color"), _Description("")> _Property BorderStyle() As MyColorsGetReturn colorPickedEnd GetSet(ByVal Value As MyColors)colorPicked = ValueEnd SetEnd Property - See more at: http://www.go4sharepoint.com/Forum/drop-list-web-part-properties-pane-1768.aspx#sthash.twKldCJe.dpuf

1 Answer 1

1

You have to store a string that serializes all your values.
Obviously, since the string has now a special meaning, WebBrowsable only won(t do the magic to translate it into a nice selection UI.
To handle the UI to display/set values in this string, you'll need to develop your own Tool part. You'll find a lot of examples on the Web, e.g.:

11
  • Is there any full fledge example?
    – Happy
    Feb 3, 2016 at 10:38
  • One I found with my Google-fu: microsoftsharepointdevelopment2010.blogspot.fr/2012/03/…. It only adds one checkbox, but can be easily extended to multiple checkboxes.
    – Evariste
    Feb 3, 2016 at 10:51
  • A good one I've just found, unfortunately (at least for you tavaritch... :-p) it's in French: developpez.net/forums/d463544/dotnet/general-dotnet/…. The 4th post in the thread contains a good ToolPart sample that create a CheckBoxList...
    – Evariste
    Feb 3, 2016 at 10:55
  • Do i create seperate css file and then i need to refer it?
    – Happy
    Feb 3, 2016 at 12:33
  • CSS? This has nothing to do with CSS... Maybe you mean .cs (C#)? Yup, a ToolPart is made of a dedicated class, so a new .cs file is the recommended approach.
    – Evariste
    Feb 3, 2016 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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