private void btnDelete_Click(object sender, EventArgs e) { string message = "Are You Sure To Delete Zone " + txtZoneName.Text + "?"; if (MessageBox.Show(message, "Delete Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { ZoneBL objCate = new ZoneBL() { ZoneId = Convert.ToInt32(txtSearch.Text) }; objCate.Delete(); MessageBox.Show("Record Delete Successfull"); loadData(); ClearGroup(); } else { MessageBox.Show("No Record Deleted"); } }
private void dgvZone_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { int rowindex = e.RowIndex; int Columnindex = e.ColumnIndex; if (Columnindex == 0) { txtZoneID.Text = dgvZone.Rows[rowindex].Cells[2].Value.ToString(); txtZoneName.Text = dgvZone.Rows[rowindex].Cells[3].Value.ToString(); txtZoneName.Enabled = true; } else if (Columnindex == 1) { ZoneBL objcate = new ZoneBL() { ZoneId = Convert.ToInt32(dgvZone.Rows[rowindex].Cells[2].Value) }; objcate.Delete(); MessageBox.Show("Deleted Successfully"); loadData(); } }