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

[Solved] Set Selected Row

1 Answer 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kaleeswara Murthy
Top achievements
Rank 1
Kaleeswara Murthy asked on 29 Jan 2010, 12:32 PM
Hi,

I have the button forward and backward.

When i click the Forward button. the selection of the rows go to next record.

Initially i have selected first row. Now i am clicking forward the grid should select the second row.

Same like backward also.

how to do this ?

Regards,
Kalees

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 29 Jan 2010, 12:53 PM
Hello Kaleeswara Murthy,

Well that should be pretty simple. First you should get the index of the currently selected row:

var index = this.myGrid.Items.IndexOf(this.myGrid.SelectedItem);

and after that depending on the action you should decrement or increment the index. Once you have the index of the item that should be selected next:

this.myGrid.SelectedItem = this.myGrid.Items[nextIndex];

that should do the job.


Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Kaleeswara Murthy
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or