Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个从数据库填充的复选框列表。列表中的项目数可以不同。我想使用 foreach 循环获取所有选定的值并将其存储在数据库中。我该怎么做?
如果像这样检查每个复选框列表元素,您可以使用 foreach 循环并测试它:
foreach (ListItem item in youListName.Items) { if (item.Selected){ //do something with your item } }