protected void LnkDelete_Click(object sender, EventArgs e) { int ObjectID = Convert.ToInt16(Gridview.SelectedDataKey.Value.ToString()); List <ClientCode> selectedObject = _businesscode.GetClients($"WHERE Client_ID = {ObjectID}"); _businesscode.DeleteClient(selectedObject[0].ID); 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 id = (int)GridView.DataKeys[i].Value; _businesscode.DeleteContract(-1, string.Format("OR Client_ID = {0}", id)); _businesscode.DeleteClient(Convert.ToInt32(id)); } } } Response.Redirect("../Site/ClientPage.aspx"); }