I would like to select a specific cell by giving the column and the row index. For exemple (Image):
I would like to select the cell where the column index is 2 and the row index is 2 (It will select the cell where "Portugal" is written).
It should be something like myGrid.SelectCell(Columns[2], Rows[2]);
Is there any way of doing this?
Thank you,
Evelyn
4 Answers, 1 is accepted
0
Hello Evelyn,
I would suggest you to check the Programmatic Selection help article for a reference.
Regards,
Yoan
Telerik
I would suggest you to check the Programmatic Selection help article for a reference.
Regards,
Yoan
Telerik
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 Feedback Portal
and vote to affect the priority of the items
0
Evelyn
Top achievements
Rank 1
answered on 23 Sep 2015, 03:09 PM
I checked the article but I couldn't understand something:
GridViewCellInfo cellToSelect = new GridViewCellInfo(item, column, this.radGridView);
This constructors expect 3 parameters: an object, GridViewColumn, GridViewDataControl.
To get the second parameter (GridViewColumn), I code like this: Telerik.Windows.Controls.GridViewColumn column = this.Columns[0];. It gets the first column of my grid. And the third paremeter, I reference the radgrid itself. But I can't understand what is this object paramenter that is required.. Can you explain to me?
Thank you,
Evelyn
GridViewCellInfo cellToSelect = new GridViewCellInfo(item, column, this.radGridView);
This constructors expect 3 parameters: an object, GridViewColumn, GridViewDataControl.
To get the second parameter (GridViewColumn), I code like this: Telerik.Windows.Controls.GridViewColumn column = this.Columns[0];. It gets the first column of my grid. And the third paremeter, I reference the radgrid itself. But I can't understand what is this object paramenter that is required.. Can you explain to me?
Thank you,
Evelyn
0
Accepted
Hi Evelyn,
This is the business object behind (the item) behind the row. You want to select a cell using a code similar to the following one:
using the GridViewCellInfo you can use very similar code to "find" the needed cell. You can use directly GridView's Items collection like so:
Then you need to add this cell in GridView's SelectedCells collection.
Regards,
Yoan
Telerik
This is the business object behind (the item) behind the row. You want to select a cell using a code similar to the following one:
SelectCell(Columns[2], Rows[2]);
cellToSelect = new GridViewCellInfo(this.clubsGrid.Items[0], this.clubsGrid.Columns[1], this.clubsGrid);
Then you need to add this cell in GridView's SelectedCells collection.
Regards,
Yoan
Telerik
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 Feedback Portal
and vote to affect the priority of the items
0
Evelyn
Top achievements
Rank 1
answered on 25 Sep 2015, 01:16 PM
Hello Yoan,
Thank you so much for your attention. It worked just fine.
Evelyn