private void clorecord_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (clorecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit") { Class1.stuId = Convert.ToInt32(clorecord.Rows[e.RowIndex].Cells[0].Value); this.Hide(); AddCLO cl = new AddCLO(); cl.Show(); } if (clorecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete") { int cloId = Convert.ToInt32(clorecord.Rows[e.RowIndex].Cells[0].Value); if (MessageBox.Show("Are you sure to perform this action!?" + clorecord.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SqlConnection newconn = new SqlConnection(con); newconn.Open(); SqlCommand command = new SqlCommand("delete from Rubric where CloId = '" + cloId + "'", newconn); command.ExecuteNonQuery(); newconn.Close(); newconn.Open(); SqlCommand command1 = new SqlCommand("delete from Clo where Id = '" + cloId + "'", newconn); command1.ExecuteNonQuery(); newconn.Close(); this.cloTableAdapter.Fill(this.projectBDataSet.Clo); } } }
private void btnaddclo_Click(object sender, EventArgs e) { this.Hide(); AddCLO addnew = new AddCLO(); addnew.Show(); }