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

How do I obtain cell data from GridViewCellInfo?

1 Answer 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 18 Mar 2011, 06:17 PM
My objective is to obtain a collection of cell data when a user selects a non-contiguous selection (SelectionMode="Extended" and ClipboardCopyMode="Cells").  The SelectedCells property returns a collection of GridViewCellInfo items.  GridViewCellInfo has two properties that expose the underlying data object and a GridViewColumn.  From these two pieces of information, how can I obtain the cell content?

1 Answer, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 18 Mar 2011, 07:01 PM
Hello Brian,

 Both GridViewBoundColumnBase (and its descendants like GridViewDataColumn, GridViewComboBoxColumn, etc.) and GridViewExpressionColumn expose a method called GetValueForItem. You need to check if the column in the CellInfo is either of those two types and if so, call the GetValueForItem method on the column, passing the Item from the CellInfo. This will return the value of the cell.

Greetings,
Yavor Georgiev
the Telerik team
Tags
GridView
Asked by
Brian
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or