怎么获取SQL Server中的checkboxlist选中的值?
不知哪里出错,老是得不到值,得到的结果是空。请大家帮忙解决一下,谢谢。
我要做的是:在SQL Server外一个button后,获取到datalist中checkboxlist时里面选中的值.
protected void Button1_Click(object sender, EventArgs e)
{
string str_value = "";
bool BFIRST = true;
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
if (BFIRST)
{
str_value += CheckBoxList1.Items[i].Value;
BFIRST = false;
}
else
{
str_value += "," + CheckBoxList1.Items[i].Value;
}
}
}
}
要在生成的aspx页面中显示选取中的值,程序写到这边不知道怎么写了,不论怎么写都是错的,请大家帮帮忙看一下。