I am currently developing a SharePoint 2010 WebPart that has a custom property which has to capture the Url of an external website. In an attempt to make the WebPart more complete I would like the property to display the Hyperlink selector used by other SharePoint WebPart's for allowing users to select the correct Url.

How do I go about telling my property to use a different input editor when displaying the toolpane?

  • I apologise up front if this is a duplicate. I tried searching on both Google and SharePoint Overflow, but seem to be using the incorrect terminology to get the right information I need. – BinaryMisfit Feb 14 '11 at 10:01

Create an editor part for your Web Part: http://www.wictorwilen.se/Post/Web-Part-Properties-part-2-Editor-Parts.aspx

  • Do I need to do this even if I want one of the standard editors that are already being used? – BinaryMisfit Feb 14 '11 at 11:09
  • Yea, if you would like to use a picker or similar. Properties are only automagically converted to simple input types by default: string->text box; int->text box; bool -> checkbox; enum -> dropdown etc. – Wictor Wilen MCA MCM MVP Feb 14 '11 at 16:35

When you want to appear custom properties in the webpart properties and you don't want to create an editor part, which is not that difficult at all!, you can mark the properties WebBrowsable. The propery will show up in the Miscellaneous section.

More information can be found here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webbrowsableattribute.aspx

And Wictor is showing this also: http://www.wictorwilen.se/Post/Web-Part-Properties-part-1-introduction.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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