selected row

  • Thread starter Thread starter Dean L. Howen
  • Start date Start date
D

Dean L. Howen

dear friends,
I try to determine which DataRow, in DataTable/DataSet, is selected
when user chooses a row in DataGrid. I've been tried to use
BindingContext[""].Position, but it didn't work. Please tell me why or give
me a new way
Thanks
 
Hi,

dataTable1.DefaultView (or other DataView that you use)
and check its index by dataGrid1.IsSelected(index)

HTH
Marcin
 
thanks.
But the problem will occur if user sort the datagrid, the result will not be
the thing we expect

Marcin Grzêbski said:
Hi,

dataTable1.DefaultView (or other DataView that you use)
and check its index by dataGrid1.IsSelected(index)

HTH
Marcin
dear friends,
I try to determine which DataRow, in DataTable/DataSet, is selected
when user chooses a row in DataGrid. I've been tried to use
BindingContext[""].Position, but it didn't work. Please tell me why or
give me a new way
Thanks
 
Dean said:
thanks.
But the problem will occur if user sort the datagrid, the result will not be
the thing we expect

If You're sure that .DefaultView is not sorted according to DataGrid
then i recommend to use DataView object as a interface between
your DataTable and your DataGrid. All sorting (and edit) changes should
be kept in that DataView.

Marcin
 
OK! it works.
Thanks so much.

Marcin Grzêbski said:
If You're sure that .DefaultView is not sorted according to DataGrid
then i recommend to use DataView object as a interface between
your DataTable and your DataGrid. All sorting (and edit) changes should
be kept in that DataView.

Marcin
 
Back
Top