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 have an visual web part with custom enumeration property which is rendered as drop-down list. I'd like to localize what is displayed in the list, because it's not very informative for the end user. Basically the main question is: how one can override default drop-down rendering to provide custom display strings for each enumeration value?

share|improve this question
    
Are you talking about a dropdown that is in the edit panel (right side of the page) or one that is rendered in the web part itself? –  Jon Lester Oct 6 '11 at 13:29
    
I mean drop down list in the edit panel, right side of the page. –  jjczopek Oct 6 '11 at 13:32
add comment

1 Answer

up vote 1 down vote accepted

What you want to do is set the "WebBrowsable" attribute to false on that web part property and implement your own EditorPart (which is just a specialized control for editing web parts). You will have complete control over it. There are a few methods you'll need to implement (both in your webpart and editorpart classes), but it is pretty straightforward. The approach is described in MSDN here: http://msdn.microsoft.com/en-us/library/hh228018.aspx

You can choose to allow SharePoint to automatically rendor the editing controls for your other properties (assuming you have them) or you can do it all yourself in your editor part.

share|improve this answer
    
thanks, will look into that. –  jjczopek Oct 6 '11 at 17:50
add comment

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.