Wednesday, January 19, 2011

Save multiple choice values in SharePoint ListItem

You will find that your checkbox list is populated with the selected value.
Save selected checkboxes in the list item as below



SPFieldMultiChoiceValue multiValue = new SPFieldMultiChoiceValue();
foreach (ListItem item in multiValueInputFormCheckBoxList.Items)
{
if (item.Selected) multiValue.Add(item.Value);
}
item["multivalued choice field name"]= multiValue;


Happy Coding !!!

5 comments:

  1. Wonderful.. really helped a lot

    ReplyDelete
  2. Actually searching from last 1Hr. and finally got it!
    This helped me a lot! Thanks! :-)
    Visit My Blog

    ReplyDelete
  3. oh why, why SharePoint all that hard. all you have to look for and try ... There are no simple ways

    ReplyDelete
  4. New to this...
    Do you add that code in the Default.aspx.cs or the Default.aspx or in a script file

    ReplyDelete