代码如下:
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
string sStr = "<br>";
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected == true)
{
sStr += CheckBoxList1.Items[i].Text+"<Br>";
}
} Label1.Text = "当前选择了:" + sStr;
}
运行后选中CheckBox中的选项毫无效果~~~~
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
string sStr = "<br>";
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected == true)
{
sStr += CheckBoxList1.Items[i].Text+"<Br>";
}
} Label1.Text = "当前选择了:" + sStr;
}
运行后选中CheckBox中的选项毫无效果~~~~
{
if (!IsPostBack)
{
DataGrid1.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CheckBoxList绑定
}
}