首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在ASP.NET C#中使用foreach获取CheckBoxList中选定项的值?

如何在ASP.NET C#中使用foreach获取CheckBoxList中选定项的值?
EN

Stack Overflow用户
提问于 2013-09-21 03:09:26
回答 10查看 323.5K关注 0票数 76

我有一个这样的CheckBoxList:

代码语言:javascript
复制
<asp:CheckBoxList ID="CBLGold" runat="server" CssClass="cbl">
    <asp:ListItem Value="TGJU"> TG </asp:ListItem>
    <asp:ListItem Value="GOLDOZ"> Gold </asp:ListItem>
    <asp:ListItem Value="SILVEROZ"> Silver </asp:ListItem>
    <asp:ListItem Value="NERKH"> NE </asp:ListItem>
    <asp:ListItem Value="TALA"> Tala </asp:ListItem>
    <asp:ListItem Value="YARAN"> Sekeh </asp:ListItem>
</asp:CheckBoxList>

现在,我想使用foreach从这个CheckBoxList中获取所选项目的值,并将这些值放到一个列表中。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18924147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档