Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top