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

How do I get cell text?

4 Answers 232 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 04 Mar 2013, 09:27 PM
How do I get the display text of a cell? (The output of the CellFormatting() event.) Everything seems to return the value in the data source.

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 05 Mar 2013, 02:53 PM
Hello Jay,

Thank you for contacting us.

In the CellFormatting event you should be able to get information via the e.CellElement.
Text property.

I hope this helps.

Greetings,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

Interested, but can’t attend? Register anyway and we’ll send you the recording.
0
Jay
Top achievements
Rank 1
answered on 05 Mar 2013, 04:14 PM
Thanks for the response Peter.

Yes, I can get the cell text from inside the CellFormatting event. The problem is I can't get the cell text from outside the CellFormatting event.

For example, when I'm trying to export the grid to an Excel file, the CellFormatting event does not help unless I can somehow call it for each cell. In order to call CellFormatting() I need a CellFormattingEventArgs object, but I don't know how to make one of these. I need a GridRowElement for each cell, but I don't know how to get a GridRowElement from my RadGridView object.
0
Peter
Telerik team
answered on 07 Mar 2013, 04:29 PM
Hi Jay,

Thank you for the clarifications.

You can access the Cell visual element's 
Text property only in the CellFormatting event because RadGridView is virtualized control and a few visual items (for example 25) represents many logical items (the whole table) e.g. the visual items are reused. In the other places you can access only the Value property from the logical items.

Should you have any other questions or suggestions, do not hesitate to contact us.

Kind regards,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Jay
Top achievements
Rank 1
answered on 07 Mar 2013, 05:51 PM
Thanks for the info. Peter.
Tags
GridView
Asked by
Jay
Top achievements
Rank 1
Answers by
Peter
Telerik team
Jay
Top achievements
Rank 1
Share this question
or