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

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?

share|improve this question
    
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. –  Diago Feb 14 '11 at 10:01

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer
    
Do I need to do this even if I want one of the standard editors that are already being used? –  Diago 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

share|improve this answer

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.