62,074
社区成员
发帖
与我相关
我的任务
分享
public void aa(object sender, System.EventArgs e)
{
CheckBox cb = (CheckBox)sender;
if (cb.Text == "全选")
{
foreach (GridViewRow gv in this.GridView1.Rows)
{
CheckBox cd = (CheckBox)gv.FindControl("CheckBox1");
cd.Checked = cb.Checked;
cb.Text = "反选";
}
}
else
{
cb.Text = "反选";
foreach (GridViewRow gv in this.GridView1.Rows)
{
CheckBox cd = (CheckBox)gv.FindControl("CheckBox1");
cd.Checked = cb.Checked;
cb.Text = "全选";
}
}
//假设你在第一列绑定了 news_id
string sql = "delete from news where news_id='" + GridView1.Rows[i].Cells[0].Text+ "'";