How do I get cell text?

5 posts, 0 answers
  1. Jay
    Jay avatar
    8 posts
    Member since:
    Aug 2012

    Posted 04 Mar 2013 Link to this post

    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.
  2. Peter
    Admin
    Peter avatar
    1160 posts

    Posted 05 Mar 2013 Link to this post

    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.
  3. Jay
    Jay avatar
    8 posts
    Member since:
    Aug 2012

    Posted 05 Mar 2013 Link to this post

    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.
  4. Peter
    Admin
    Peter avatar
    1160 posts

    Posted 07 Mar 2013 Link to this post

    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.
  5. Jay
    Jay avatar
    8 posts
    Member since:
    Aug 2012

    Posted 07 Mar 2013 Link to this post

    Thanks for the info. Peter.
Back to Top