这是我写的程序:
private void initialCheckBoxList(string strValue)
{
string[] array = strValue.Split(',');
for (int i = 0; i < array.Length - 1; i++)
{
Response.Write("长度:" + array.Length + "<br/>");
for (int a = 0; a < CheckBoxList3.Items.Count; a++)
{
if (array[i] == CheckBoxList3.Items[a].Text)
{
Response.Write(array[1] + "<br/>");
Response.Write(CheckBoxList3.Items[1].Text);
CheckBoxList3.Items[a].Selected = true;
break;
}
}
}
}调用上面的方法:string strValue = dr["nid"].ToString();//这个值是从数据库取出来的
//Response.Write(strValue);
initialCheckBoxList(strValue);
我出现的问题是存入多个checkboxlist的值,读取出来的时候就选中一项,其他的都没选中!
请求各位的帮助
private void initialCheckBoxList(string strValue)
{
string[] array = strValue.Split(',');
for (int i = 0; i < array.Length - 1; i++)
{
Response.Write("长度:" + array.Length + "<br/>");
for (int a = 0; a < CheckBoxList3.Items.Count; a++)
{
if (array[i] == CheckBoxList3.Items[a].Text)
{
Response.Write(array[1] + "<br/>");
Response.Write(CheckBoxList3.Items[1].Text);
CheckBoxList3.Items[a].Selected = true;
break;
}
}
}
}调用上面的方法:string strValue = dr["nid"].ToString();//这个值是从数据库取出来的
//Response.Write(strValue);
initialCheckBoxList(strValue);
我出现的问题是存入多个checkboxlist的值,读取出来的时候就选中一项,其他的都没选中!
请求各位的帮助
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货