如何在Asp.net获得所选项目的CheckBoxList [英] how to get selected item in CheckBoxList in Asp.net

查看:122
本文介绍了如何在Asp.net获得所选项目的CheckBoxList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在page.is那里的CheckBoxList任何方式使用来获取所有选定项的值LINQ?

I have a CheckBoxList in my page.is there any way to get all selected item values using linq?

什么是获得的CheckBoxList选中的项值的最佳方式是什么?

what is the best way to get selected item values in CheckBoxList?

推荐答案

您可以去这所采取的复选框列表中的项目,并将其转换为ListItems的,​​并从该集合获取那些谁被选中,是这样的:

You could go about this by taking the items of the checkbox list and converting them to ListItems and from that collection fetch those who is selected, like this:

var selectedItems = yourCheckboxList.Items.Cast<ListItem>().Where(x => x.Selected);

这篇关于如何在Asp.net获得所选项目的CheckBoxList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆