protected void gridCustomer_RowDeleting(object sender, GridViewDeleteEventArgs e) { HiddenField txtId = this.gridCustomer.Rows[e.RowIndex].Cells[0].FindControl("Id") as HiddenField; if (!string.IsNullOrEmpty(txtId.Value)) { BasicInformationProxy.DeleteCustomer(new Guid(txtId.Value)); } Search(); }
protected void btnDelete_Click(object sender, ImageClickEventArgs e) { if (!CanEdit()) { return; } try { bool needSearch = false; foreach (GridViewRow row in this.gridCustomer.Rows) { CheckBox check = row.Cells[0].FindControl("check") as CheckBox; if (check == null) { continue; } if (check.Checked) { HiddenField txtId = row.Cells[0].FindControl("Id") as HiddenField; if (!string.IsNullOrEmpty(txtId.Value)) { BasicInformationProxy.DeleteCustomer(new Guid(txtId.Value)); } needSearch = true; } } if (needSearch) { Search(); } } catch (Exception ex) { this.lblError.Text = ex.Message; } }