Monday, August 16, 2010

Adding multiple values into a Lookup Column programmatically

Sometime, as we create lists programmatically, we might also have to add some data. The following code helps to create multiple field values and then add them to a multi choice field.

for (int j = 0; j < lookupValues.Length; j++)
{
    SPFieldLookupValue value = new SPFieldLookupValue(intValue, strValue);
    multiChoice.Add(value.ToString());
}
listItem1["Multi choice column name"] = multiChoice;
multiChoice is a column declared as SPFieldMultiChoiceValue
Technorati Tags: ,,,

No comments:

Post a Comment