|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Locating in DataGridHello 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. Sergey,
When I understand you well is the dataview find what you are looking for to find your ID. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadataviewclassfindtopic.asp I hope this helps? Cor 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... :( "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/news:u4DdmoU3EHA.2568@TK2MSFTNGP10.phx.gbl... > Sergey, > > When I understand you well is the dataview find what you are looking for to > find your ID. > > frlrfsystemdatadataviewclassfindtopic.asp Show quote > > I hope this helps? > > Cor > > Sergey,
Did you really try it? Cor Show quote "Povalyaev Sergey" <serg***@vtb.vrn.ru> ... > 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... :( > > > "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message > news:u4DdmoU3EHA.2568@TK2MSFTNGP10.phx.gbl... >> Sergey, >> >> When I understand you well is the dataview find what you are looking for > to >> find your ID. >> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ > frlrfsystemdatadataviewclassfindtopic.asp >> >> I hope this helps? >> >> Cor >> >> > > |
|||||||||||||||||||||||