多个复选框当查询条件的问题 我有很多个复选框 大约100个 是条件用来查询 怎么才可以可比把 选种的复选框就是Checked=true的便利出来然后组成sql语句 来查询 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string str = "";//复选框前面的select语句 string[] strItem =new string[CheckBoxList1.Items.Count]; for (int i = 0; i < CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected) { str += strItem[i]+"='"+CheckBoxList1.Items[i].Value+"',"; } }用一个checkboxlist吧,那样好遍历一些,读取也非常的方便! string sql = "SELECT * FROM yourTable WHERE 1=1 ";foreach(ListItem item in CheckBoxList1.Items) { if(item.Selected) { // as following // sql += item.Value > someValue .... }} js window.location.replace()问题 高手帮帮忙!!! 还是缓存问题。 关于事务,我这么写对不对. DataGrid 动态 绑定 DropDownlist asp.net网站访问异常问题求助 空间和域名的问题 用C#作一个购物车程序,不知道该怎么实现,是把商品信息放在结构里吗? 多次弹出同一个窗口的问题 spring.net在web.config中的配置报错 怎样定义一个类的数组 一个C#正则。怎样替换一段字符串。。。。。。
string str = "";//复选框前面的select语句
string[] strItem =new string[CheckBoxList1.Items.Count];
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
str += strItem[i]+"='"+CheckBoxList1.Items[i].Value+"',";
}
}
用一个checkboxlist吧,那样好遍历一些,读取也非常的方便!
foreach(ListItem item in CheckBoxList1.Items) {
if(item.Selected) {
// as following
// sql += item.Value > someValue ....
}
}