{
CBoxListAnswer.Items[j].Selected = true;
}
}
}
范例二、循环来遍历读取每个选项,将选中的选项的值拼接成字符串,以便后续插入数据库
string m_strTemp = string.Empty;
for (int i = 0; i < CBoxListAnswer.Items.Count; i++)//读取CheckBoxList 选中的值,保存起来
{
if (CBoxListAnswer.Items[i].Selected)
{
m_strTemp += CBoxListAnswer.Items[i].Value + ",";
}
}
if (!string.IsNullOrEmpty(m_strTemp))
Label1.Text = m_strTemp.Substring(0, m_strTemp.Length - 1);
else
Label1.Text = m_strTemp;








