//GridView中的CheckBox的全选,全不选
protected void Button2_Click(object sender, EventArgs e)
{
foreach (GridViewRow gr in GridView1.Rows)
{
CheckBox chk = (CheckBox)gr.Cells[0].FindControl("checkbox1");
if (!chk.Checked)
{
chk.Checked = true;
Button2.Text = "取消全选";
}
else
{
chk.Checked = false;
Button2.Text = "全选";
}
}
}