This is a migrated thread and some comments may be shown as answers.

FindItemByKeyValue not working

3 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pedrotti
Top achievements
Rank 1
pedrotti asked on 15 Apr 2013, 02:45 PM
Hello

I can't get items when I use the 

              Dim MyItem As GridDataItem = gDGD.MasterTableView.FindItemByKeyValue("cInstID", Integer.Parse(cInstID))


              MyItem is allways = nothing

But it find it when i do
     For Each updatedItem As GridDataItem In gDGD.Items

                If updatedItem.GetDataKeyValue("cInstID").ToString() = cInstID Then
......          

can you explain where is the problem ?

Thank you a lot for your help

Anne

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2013, 06:16 AM
Hello,

Dim cInstID As String = "0"
 
Dim Myitem As GridDataItem = ( _
    Where item.GetDataKeyValue("cInstID").ToString() = cInstID).FirstOrDefault()
 
        ' Access your GriddataItem Here
If Myitem IsNot Nothing Then
End If

Note : This thing only serach in currentpage index.

Like : you have assigned 100 items to grid, Grid pagesize is 10 and grid cuurent page index is 2. 
Then it will find in between 21 to 30 rows.
Thanks,
Jayesh Goyani
0
pedrotti
Top achievements
Rank 1
answered on 16 Apr 2013, 06:41 AM
Thank you for your reply

But i don't undestand your solution

What is 'Item' ?

My proc├ędure is call by ajaxrequest and i want to retreive data from the data datakey
I don't want to loop on the grid because it have a lot of row !

have a good day

Anne
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2013, 08:29 AM
Hello,

Note : This thing only serach in currentpage index.

Like : you have assigned 100 items to grid, Grid pagesize is 10 and grid cuurent page index is 2. 
Then it will find in between 21 to 30 rows.


Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
pedrotti
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
pedrotti
Top achievements
Rank 1
Share this question
or