Loop through grid - reading cell values?

7 posts, 1 answers
  1. Ben
    Ben avatar
    23 posts
    Member since:
    Mar 2012

    Posted 22 Jun 2012 Link to this post

    When a user clicks a button I want to loop through the entire grid, row by row, reading the value of a specific column cell.

    Can you tell me the easiest, most efficient way to accomplish this?

    Thank you very much.

  2. Dimitrina
    Admin
    Dimitrina avatar
    3151 posts
    Member since:
    Sep 2014

    Posted 25 Jun 2012 Link to this post

    Hello,

    Since the RadGridView supports UI Virtualization, it is not recommended to work with the visual elements (i.e. GridViewRows, GridViewCells) and their properties.

    May I ask you to share what your final goal is? 

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Download a free trial of UI for WPF
  4. Ben
    Ben avatar
    23 posts
    Member since:
    Mar 2012

    Posted 25 Jun 2012 Link to this post

    I load the grid from a SQL stored procedure.  Because of some security conditions and business rules, I treat the grid as a disconnected data set.

    Users make changes.  When they click the 'Save' button, I want to read through each row of the grid, check the data against our business rules, then run a stored procedure to update the data row by row. 

    All I really want to do is look at the grid values in the code behind.  Can anyone tell me the simplest way to accomplish this?  I'm new to the Telerik suite.  This is a newbie question.

    Thank you.

  5. Dimitrina
    Admin
    Dimitrina avatar
    3151 posts
    Member since:
    Sep 2014

    Posted 25 Jun 2012 Link to this post

    Hello,

    Based on your description, I would suggest you to iterate through the Items collection of the RadGridView and validate each item against your business rules. 

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Ben
    Ben avatar
    23 posts
    Member since:
    Mar 2012

    Posted 25 Jun 2012 Link to this post

    That's what I would like to do.  Can you please post some code that shows me how I can access the values in each row?  I'm having trouble understanding how to get at these values in the code behind.  Thank you.

  7. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3151 posts
    Member since:
    Sep 2014

    Posted 27 Jun 2012 Link to this post

    Hello,

     I have attached the sample project suggested to you from my colleague in your other thread so that it is available to the whole community.

    Greetings,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Ben
    Ben avatar
    23 posts
    Member since:
    Mar 2012

    Posted 27 Jun 2012 Link to this post

    This is just what I need.  Thank you.

Back to Top
Download a free trial of UI for WPF