DataGrid selecting rows


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
 
Ad

Advertisements

G

Guest

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
 
G

Guest

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
 
Ad

Advertisements

Joined
Sep 15, 2005
Messages
1
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top