Get available SharePoint list field options in a field type (Multi)Choice from codebehind

In a list with a field type “Choice” you can know available options of this field from codebehind without reading all list values and not making them unique with Distinct(). Especially, you can’t just read and make Distinct() list values if your field allows multiple choice or if you don't have all options.

It’s easy with SharePoint class SPFieldChoice and method "Choices" that returns the Choices that are used in the multichoice field.

For example, our list is on current SPWeb, our list is called "Products" and it’s in the current SPWeb and our field is called "Brand"


So we use only SharePoint object model and we don’t need to think out anything.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment Notes of web-specialist
Since 2009