selected row

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
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi,

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

HTH
Marcin
 
D

Dean L. Howen

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
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

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
 
D

Dean L. Howen

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
 

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