Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Updating a multichoice column of an item

$
0
0

Hi,

I have a multi-choice column in a sharepoint list.

The choices being: Choice 1,Choice 2,Choice 3,Choice 4.

I tried creating a visual webpart, where in i'm trying to update the column programmatically, I have used a checkbox list to select multiple options,

Here is the code:

<asp:CheckBoxList ID="chkTechonology" runat="server"></asp:CheckBoxList>


The code behind to update the item being:

 List<string> objList=new List<string>();
                foreach (ListItem item in chkTechonology.Items)
                {
                    if (item.Selected )
                    {
                        objList.Add(item.Value);

                    }
                }
                listItem["Technology"] = String.Join(", ", objList.ToArray()).Trim(';','#');

It gets saved in the list, but the issue is, whenever i try to edit the item in the list, all the selections are gone.

I need to select the options again and then save the item.

Regards,

Sachin



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>