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

How to cycle through all datarows in a Grid in the order that is currently selected in the grid

9 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hkdave95
Top achievements
Rank 2
hkdave95 asked on 14 Apr 2008, 10:08 PM
Hi

I am trying to find out upon which page a particular data row falls.

In order to do this I need to cycle through each row in the grid in the current order of the grid.

Please can you tell me how I might retreive a collection showing all items in the Grid in it's current order.

Kind Regards

David

9 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 17 Apr 2008, 03:49 PM
Hello hkdave95,

Could you give us more details on how is the row order changed? Is it because of server or client event? What happens when the data row falls? Any additional information can lead us to the source and we would be able to find a proper solution for you.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
hkdave95
Top achievements
Rank 2
answered on 17 Apr 2008, 05:56 PM
Hi

I am referring to an order change if any of the sort buttons are pressed.

This will change the page that the item falls upon therefore when I attempt to locate it and "open" the row in say edit mode I need the "current order" within the grid.

Hope this provides enough information.

Kind Regards

David
0
Iana Tsolova
Telerik team
answered on 18 Apr 2008, 01:51 PM
Hi hkdave95,

Thank you for the details.
You could retrieve the current order of the grid's items on ItemDataBound. This event is fired after the NeedDataSource, therefore after the grid has received the new sorted data. And here you could see the order in which the items are bound and find where your data row falls.

Let us know if you need further directions.

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
hkdave95
Top achievements
Rank 2
answered on 18 Apr 2008, 11:02 PM
Hi

I am actually trying to find the page that a row falls on in the ItemCommand Event.

In order to do this I need to "for each" the current collection of data in the current sort order.

Any more ideas ?

Kind Regards

David
0
Iana Tsolova
Telerik team
answered on 21 Apr 2008, 02:47 PM
Hello hkdave95,

Unfortunately on ItemCommand the new order is not available yet. When the grid is sorted, the ItemCommand event is fired where the new sort expressions are added to the grid. Then the NeedDataSource event is fired and the sorted data is passed to the grid. After that on ItemDataBound the items are bound with the new order and you could retrieve it here. The new order of the grid items is available on PreRender event. 

Find more information about the grid event sequence here.

Please let us know if you need more help and if I missed something in my explanation.

Best regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
hkdave95
Top achievements
Rank 2
answered on 22 Apr 2008, 06:39 AM
Hi

Correct me if I am wrong but the ItemDataBound event does not cyle through all data items.

I thought that it cycles through the current page items. Therefore how am I going to hit the item if it lies on another page ?

Correct me if I am wrong.

Kind Regards

David
0
Iana Tsolova
Telerik team
answered on 22 Apr 2008, 11:09 AM
Hello hkdave95,

You are right that only the items of the current page are available on ItemDataBound. And unfortunately only data items of the current page are accessible and available through the grid lifecycle. Therefore on ItemDataBound, DatBound or PreRender events of the grid you could check if your data row falls on the current page and then implement the corresponding logic for it.

I hope this information helps.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
hkdave95
Top achievements
Rank 2
answered on 23 Apr 2008, 10:38 PM
Hi

Are you planning a method which might allow a user to cycle through the items in a grid in current sort order ? Outside of ItemDataBound that is.

Kind Regards

David
0
Iana Tsolova
Telerik team
answered on 24 Apr 2008, 10:35 AM
Hello hkdave95,

I am afraid that we do not have plans to implement methods traversing through data items which are not from the current page.

Please excuse us for the inconvenience.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
hkdave95
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
hkdave95
Top achievements
Rank 2
Share this question
or