思路:遍历gridView1的每一行,该行中checkbox列被勾选则设置该行为选中状态,执行gridView1提供的DeleteSelectedRows方法则可
public void DoDelete() { for (int i = 0; i < gridView1.DataRowCount; i++) { if (gridView1.GetDataRow(i)["checked"].ToString().Trim().ToLower() == "true") { gridView1.SelectRow(i); } else { gridView1.UnselectRow(i); continue; } } this.gridView1.DeleteSelectedRows(); gridView1.RefreshData(); }