How do I Retrieve the choice values of a column in a Document Library
Question
I am fairly new to SharePoint development and as you may all know that it is very basic for one to know how to access fields in a choice column...
My problem: I want to access the values of the Check Boxes from a Choice Column.
For Example: I have a document library called Libe, this document library has a custom column with type Choice and has 4 checkboxes with the values:
- Category 1
- Category 2
- Category 3
- Category 4
How do I get the values like literally the text values of what is in the Check Box List: "Category 1", "Category 2" ... "Category 4".
Any ideas?
I can access the column fine and get the selected values, I just do not know how to get the values the user can choose from.
Your help is very appreciated.
-------------------------------------
ANSWER:
SPFieldMultiChoice Fld = (SPFieldMultiChoice)list.Fields["Column"];
List<string> fieldList = new List<string>();
foreach (string str in Fld.Choices)
{
fieldList.Add(str);
}
Above is the answer, I can't answer my own question until I have a 100 rep.
La solution
The choice columns are worked with SPFieldMultiChoice and SPFieldMultiChoiceValue classes. Here are a few posts with examples -
How to retrieve and update from a multi choice Checkboxlist field