protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt16(GridView1.DataKeys[e.RowIndex].Values["Id"].ToString()); StudentBusinessLogic.DeleteStudent(id); RefreshData(); }
private void button2_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure to dlete this student?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) { sbl.DeleteStudent(label27.Text, department); this.Hide(); StudentsList sl = new StudentsList(loginUserName, department); sl.Show(); MessageBox.Show("Student deleted successfully."); } }