protected void btnDelete_Click(object sender, EventArgs e) { EmployeeDal employeeDal = new EmployeeDal(); int deleteCount = 0; foreach (GridViewRow row in gvMain.Rows) { if (row.Cells[0].Controls.Count != 0 && ((CheckBox)row.Cells[0].Controls[0]).Checked) { employeeDal.Delete(row.Cells[2].Text); deleteCount++; } } if (deleteCount == 0) { JScript.Instance.ShowMessage(UpdatePanel1, "请选择要删除的记录。"); } else { JScript.Instance.ShowMessage(UpdatePanel1, "删除数据成功。"); } BindData(); }
internal bool Delete(int id) { status = employeeDal.Delete(id); return(status); }
protected void btnDelete_Click(object sender, EventArgs e) { EmployeeDal employeeDal = new EmployeeDal(); int deleteCount = 0; foreach (GridViewRow row in gvMain.Rows) { if (row.Cells[0].Controls.Count != 0 && ((CheckBox)row.Cells[0].Controls[0]).Checked) { employeeDal.Delete(row.Cells[2].Text); deleteCount++; } } if (deleteCount == 0) JScript.Instance.ShowMessage(UpdatePanel1, "请选择要删除的记录。"); else JScript.Instance.ShowMessage(UpdatePanel1, "删除数据成功。"); BindData(); }