DataGrid selecting rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

When multiple rows selected on a DataGrid, how can my code find out which
rows have been selected? I thought the IsSelected property would tell me but
when I select rows on the DataGrid, the property does not evaluate to True
for the specified rows. I have a DataGrid bound to a DataTable, and I need
to be able to delete multiple rows from the table when multiple rows are
selected from the grid.

Please advise! Thanks,

Gary
 
Hi Gary,

You don't have to worry on the deletion part. Pressing Del in the selected
rows in a grid will update the bound datatable. Then you just need to call
the data adapter's Update method passing the modified dataset - the deleted
rows will be deleted from the DB.

HTH,
Rakesh Rajan
 
Hi Gary,

You don't have to worry on deleting rows. When you press Del in the selected
rows in the datagrid, the datatable bound to the datagrid will be updated.
Then, you just have to call the data adapter's Update method, passing the
modified dataset to update the DB.

Let me know if i could be of help.

HTH,
Rakesh Rajan
 
Hi Gary,
You can do the following:

get the row index of datagrid:

row_index = dataGrid1.CurrentCell.RowNumber;

select the datagrid row:

dataGrid1.Select(dataGrid1.CurrentCell.RowNumber);

Regards

Kunal
 
Back
Top