protected void DeleteRecord() { if (dataGridView1.SelectedRows.Count == 1) { StrelbaDTO strelba = dataGridView1.SelectedRows[0].DataBoundItem as StrelbaDTO; Strelba.delete(Strelba.getById(strelba.Id)); GetData(); } }
private Strelba GetSelectedStr() { // The "SelectionMode" property of the data grid view must be set to "FullRowSelect". if (dataGridView1.SelectedRows.Count == 1) { StrelbaDTO strelba = dataGridView1.SelectedRows[0].DataBoundItem as StrelbaDTO; return(Strelba.getById(strelba.Id)); } else { return(null); } }