1

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?

1
  • 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. Commented Feb 14, 2011 at 10:01

2 Answers 2

2

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

2
  • Do I need to do this even if I want one of the standard editors that are already being used? Commented Feb 14, 2011 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. Commented Feb 14, 2011 at 16:35
1

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 and acknowledge you have read our privacy policy.

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