protected void btnDelete_Click(object sender, EventArgs e) { try { for (int i = 0; i < gvMain.Rows.Count; i++) { if (gvMain.Rows[0].Cells[0].Text == "没有符合以上条件的数据,请重新查询 ") { break; } else { CheckBox chk = (CheckBox)gvMain.Rows[i].Cells[0].Controls[0]; if (chk.Enabled && chk.Checked) { dsClass.Tables[0].Rows[i].Delete(); } } } objClass.Delete(dsClass); totalCount = objClass.GetRowCount(filter); pager.RecordCount = totalCount; if (pageIndex > pager.PageCount) { pageIndex = pager.PageCount; } GridDataBind(); } catch (Exception exp) { JScript.Instance.ShowMessage(this.UpdatePanel1, exp.Message); } }