protected void btnConfig_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridViewInfo.Rows)
{
CheckBox dirCheckBox = (CheckBox)row.FindControl("DirCheak");
if (dirCheckBox != null)
{
if (dirCheckBox.Checked == true)
{
myBFUser.DeleteFlatInfo(int.Parse(GridViewInfo.DataKeys[row.RowIndex].Value.ToString()));
}
}
}
BindGridView();
}
同时还要设置GridView的DataKeyNames属性(绑定数据库字段ID)