Wednesday, January 19, 2011

Display multiple choice value of saved Listitem

Show those values which was stored in the SharePoint ListItem.
For display selected value use previous post’s “InputFormCheckBoxList”
Select listitem for display choice field’s multiple value as below



if (item["multivalued choice field name"] != null)

{

SPFieldMultiChoiceValue multiValue = new SPFieldMultiChoiceValue(item["multivalued choice field name"]);

for (int i=0; i<= multiValue.Count; i++) multiValueInputFormCheckBoxList.Items.FindByText(multiValue[i]).Selected = true; }


Happy Coding !!!

2 comments:

  1. first of all thanks to you
    for (int i=0; i<= multiValue.Count; i++) multiValueInputFormCheckBoxList.Items.FindByText(multiValue[i]).Selected = true;
    giving me following error

    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    ReplyDelete
  2. for (int i=0; i< multiValue.Count; i++) multiValueInputFormCheckBoxList.Items.FindByText(multiValue[i]).Selected = true;
    It should be like this

    ReplyDelete