<asp:CheckBoxList ID="cbxLabelList" runat="server" RepeatColumns="10" RepeatDirection="Horizontal"> </asp:CheckBoxList> DataTable dtinfo = pc.getdatainfo(""); cbxLabelList.Items.Clear(); if (dtinfo.Rows.Count>0) for (int t = 0; t < dtinfo.Rows.Count; t++) { string name = Convert.ToString(dtinfo.Rows[t][1]); cbxLabelList.Items.Add(name); } List<string> list = new List<string>(); for (int i = 0; i < cbxLabelList.Items.Count; i++) { if (cbxLabelList.Items[i].Selected) list.Add(cbxLabelList.Items[i].Text); } foreach (ListItem cb in cbxLabelList.Items) { if (cb.Selected == true) { cb.Value //每个值 pc.adddateinfo(cb.Value); } } //赋值/回显: string info = Convert.ToString(dtDate.Rows[0]["Infos"]); string[] arr= info.Split(','); for (int c=0;c<arr.Length-1;c++) { infolist.Items.Add(arr[c]); } foreach (string ar in arr) { foreach (ListItem it in infolist.Items) { if (ar == it.Value) it.Selected = true; else continue; } }