示例#1
0
 private void grdStudent_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
 {
     if (m_editWithGridView)
     {
         if (m_grdStudent_SelectedRowId >= 0)
         {
             LinqLayer.DeleteStudent(m_grdStudent_SelectedRowId);
             m_grdStudent_SelectedRowId = -1;
         }
     }
 }
示例#2
0
 private void btnStudentDelete_Click(object sender, EventArgs e)
 {
     if (grdStudent.SelectedRows.Count > 0)
     {
         LinqLayer.DeleteStudent(Convert.ToInt32(grdStudent.Rows[grdStudent.SelectedRows[0].Index].Cells["Id"].Value));
         LoadStudentGrid();
     }
     else
     {
         MessageBox.Show("You must select a student record to delete.", "Delete Student Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }