protected void LnkDelete_Click(object sender, EventArgs e) { int ObjectID = Convert.ToInt16(Gridview.SelectedDataKey.Value.ToString()); List <CRACode> selectedObject = _businesscode.GetCRAs($"WHERE CRA_ID = {ObjectID}"); _businesscode.DeleteCRA(selectedObject[0].ID); Gridview.SelectedIndex = -1; lbNotification.Visible = false; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "<script>$('#exampleModal').modal('hide');</script>", false); Load_content(); gvUpdatePanel.Update(); }
protected void Delete(object sender, EventArgs e) { for (int i = 0; i < GridView.Rows.Count; i++) { if (GridView.Rows[i].RowType == DataControlRowType.DataRow) { CheckBox chk = (CheckBox)GridView.Rows[i].Cells[0].FindControl("CheckBox") as CheckBox; if (chk.Checked) { int RecordID = (int)GridView.DataKeys[i].Value; if (_businesscode.GetRelationCRAHasProjects(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0) //--Var { _businesscode.DeleteRelationCRAHasProjects(RecordID); //--Var } _businesscode.DeleteEvaluation(-1, string.Format("OR CRA_ID = {0}", RecordID)); _businesscode.DeleteCRA(RecordID); } } } Response.Redirect("../Site/CRAPage.aspx"); }