Hi All,
I am busy building a custom webpart with various textboxes and lookup fields. All of them are saving correctly apart from the lookup fields that allows for multiple selections. I dont have this problem with lookup fields that only allow for one value to be selected.
Below is the code for getting all the selected items in my checkboxlist, converting it to a multichoice value and assigning to my list[columnname]
try
{
SPFieldMultiChoiceValue _segmentchoices = new SPFieldMultiChoiceValue();
foreach (ListItem ls3 in _segment.Items)
{
if (ls3.Selected) _segmentchoices.Add(ls3.Value);
}
myItems["Segment"] = _segmentchoices;
myItems.Update();
}
catch (Exception ex) { _errorMessage += "||| Segment : " + ex.Message; }
The values list (_segmentchoices) is correctly created and looks like this : {;#1;#2;#3;#4;#5;#}
However when its saved it only saves values 1, 3, and 5.
My code is not generating an error, so I am at a loss at what could be wrong. Any ideas on what I need to look at? Am I going about it the wrong way?
Any assistance would be appreciated. Thank you