我们介绍关于利用asp教程.net 获取checkbox值的几种方法,
html代码
c获取值。
{
int i ;
string str = "";
for (i = 0; i
if (checkboxlist1.items[i].selected ) str+ =checkboxlist1.items[i].value;
label1.text=str;
}
下面讲一下关于
第一种:获得checkbox的值
string save_cbljl = "";
for (int i = 0; i < this.cbljl.items.count; i++)
{
if (this.cbljl.items[i].selected == true)
{
save_cbljl += this.cbljl.items[i].value + ",";
}
}
response.write(save_cbljl);string save_cbljl = "";
for (int i = 0; i < this.cbljl.items.count; i++)
{
if (this.cbljl.items[i].selected == true)
{
save_cbljl += this.cbljl.items[i].value + ",";
}
}
response.write(save_cbljl);
第二种:获得checkbox的值
string str_save_cbljl = "";
foreach (listitem li in cbljl.items)
{
if (li.selected == true)
{
str_save_cbljl += li.value + ",";
}
}
response.write(str_save_cbljl);