In Sharepoint, columns like Choice Field are often used to hold multiple choice options which are then displayed as values of DropdownList / RadioButtonList / CheckboxList. While developing Custom Webparts for add/edit form (related to any List having the Choice Fields) in VS 2005, there is always a need to fetch these choice options and bind them to the corresponding ASP.Net Server Control.
An example for binding / populating an ASP.Net DropdownList with the values from a SP Choice Field: “Rating“, is provided below.
'get the List instance
Dim leadLst As SPList = web.Lists("LeadList")
'get the choice field instance
Dim fldRating As SPFieldChoice = CType(leadLst.Fields("Rating"), SPFieldChoice)
'iterate through each of the choice items to populate a dropdownlist
For Each choice As String In fldRating.Choices