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

GridView Programmatically move to next item

2 Answers 245 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dermot
Top achievements
Rank 1
Dermot asked on 28 Apr 2011, 06:02 PM
Hi,
I want to programmatically move to next item in grid view.  (This is because user clicks a button that does numerous things then moves to next item).

Following code works, except when the grid view has a filter applied.  Then it doesn't work, if the next item is filtered out.
Is there anyway around this. It's as if the gridview moves to the filtered item and therefore doesn't select anything.

        Dim x = Me.RadGridView1.ItemsSource
        Dim z As System.Windows.Data.ListCollectionView = Me.RadGridView1.ItemsSource
        Dim intPos As Integer
        intPos = z.CurrentPosition
        Me.RadGridView1.SelectedItem = z(intPos + 1)

I've also tried z.MoveCurrentToNext (which has the same problem, works unfiltered, but doesn't work when filtered).

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 28 Apr 2011, 07:21 PM
Hello Dermot,

 You can call the MoveCurrentToNext method of the RadGridView's DataItemCollection like so:
Me.RadGridView1.Items.MoveCurrentToNext()


Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dermot
Top achievements
Rank 1
answered on 29 Apr 2011, 02:38 PM
Thanks very much for the swift reply.
Your answer worked like a treat, and I feel like an idiot for not finding that.
Tags
GridView
Asked by
Dermot
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Dermot
Top achievements
Rank 1
Share this question
or