private void btnStaffAdd_Click(object sender, EventArgs e) { frmSudentAdd obj = new frmSudentAdd("0"); obj.ShowDialog(); bindData(); }
// Cell Content Click Event private void Master_shanuDGV_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (Master_shanuDGV.Columns[e.ColumnIndex].Name == "Edit") { try { string studentID = ds.Tables[0].Rows[e.RowIndex]["StdNO"].ToString(); frmSudentAdd obj = new frmSudentAdd(studentID); obj.ShowDialog(); bindData(); } catch (Exception ex) { } } else if (Master_shanuDGV.Columns[e.ColumnIndex].Name == "Delete") { try { string studentID = ds.Tables[0].Rows[e.RowIndex]["StdNO"].ToString(); if (MessageBox.Show("Are You Sure to Delete Student Details ?", "Delete Student", MessageBoxButtons.YesNo) == DialogResult.Yes) { SortedDictionary <string, string> sd = new SortedDictionary <string, string>() { }; sd.Add("@std_ID", studentID); DataSet ds1 = new DataSet(); ds1 = bizObj.SelectList("USP_Student_Delete", sd); if (ds1.Tables[0].Rows.Count > 0) { string result = ds1.Tables[0].Rows[0][0].ToString(); if (result == "Deleted") { MessageBox.Show("Student Deleted Successful, Thank You!", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); bindData(); } } } } catch (Exception ex) { } } }