Locating in DataGrid

  • Thread starter Povalyaev Sergey
  • Start date
P

Povalyaev Sergey

Hello all!

I have a DataGrid bound to a DataTable. I need to select a record in the
DataGrid that correspond to a DataRow with specified field "ID" value, but
DataGrid should be sorted by "Name" value.

As far as I see, there are no way to do this in performance sensitive way.

I have to locate a record in the DataView that is sorted by "Name". I cannot
do this via "Find" method, because I have a lot of records with same "Name".
I cannot do this via "Item" property, because DataTable has no way to
acquire index of a record in the DataTable for specified "ID".

Am I wrong and there is some way of perfoming this simple task. I have
worked with Delphi and FoxPro and this is always be very simple.

Thanks in advance!
Sergey Povalyaev.
 
P

Povalyaev Sergey

Hi, Cor!

Not exactly. I have ID and I can find DataRow via DataView sorted by "ID",
but then I want to select this row in DataGrid, that is sorted according to
"Name" field, and to do this I should set CurrentMannager.Position to the
position in the DataView that is sorted by "Name", not "ID". But this second
DataView hasn't methods to find neither for "ID" nor for DataRow, in this
case Find method will search only by "Name". Umph... :(
 
C

Cor Ligthert

Sergey,

Did you really try it?

Cor

Povalyaev Sergey said:
Hi, Cor!

Not exactly. I have ID and I can find DataRow via DataView sorted by "ID",
but then I want to select this row in DataGrid, that is sorted according
to
"Name" field, and to do this I should set CurrentMannager.Position to the
position in the DataView that is sorted by "Name", not "ID". But this
second
DataView hasn't methods to find neither for "ID" nor for DataRow, in this
case Find method will search only by "Name". Umph... :(
 

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