- //当行删除
- //int x = gridView1.GetDataSourceRowIndex(gridView1.FocusedRowHandle);
//gridView1.DeleteRow(x); - if (gridView1 == null || gridView1.SelectedRowsCount <= 0) return;
- DataRow[] dataRows = new DataRow[gridView1.SelectedRowsCount];
- for (var i = 0; i < gridView1.SelectedRowsCount; i++)
- {
- dataRows[i] = gridView1.GetDataRow(gridView1.GetSelectedRows()[i]);
- }
- gridView1.BeginSort();
- try
- {
- foreach (DataRow row in dataRows)
- {
- row.Delete();
- }
- }
- catch { }
- finally
- {
- gridView1.EndSort();
- }
选中多行删除
最新推荐文章于 2024-04-19 16:12:12 发布