1

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?

  • 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
1

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.

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.