我正在构建一个复选框列表:
<asp:CheckBoxList ID="CheckBoxes" DataTextField="Value" DataValueField="Key" runat="server"></asp:CheckBoxList>
并尝试获取所选项目的值:
List<Guid> things = new List<Guid>(); foreach (ListItem item in this.CheckBoxes.Items) { if (item.Selected) things.Add(item.Value); } }
我得到了错误
“The best overloaded method match for
‘System.Collections.Generic.List.Add(System.Guid)’
has some invalid arguments “