Looping through all rows in RadGrid

4 posts, 0 answers
  1. David
    David avatar
    13 posts
    Member since:
    Apr 2013

    Posted 31 Oct 2017 Link to this post

    I have a Radgrid that has fields on every row. These fields allow users to type in numbers. The grid also allows the user to add more rows to the grid through the Add functionality of the grid.

    I have a Save button on the button of my screen. When I click Save, I would like to loop through all the rows of the grid. Currently, in the Items collection there are only the rows in a Non-Insert state. I would like to loop through all of the rows that are in Insert mode along with all of the rows not in Insert mode.

    I have attached an example of the grid in the double state. In this example I want to look through all 5 rows not just the 4 rows which are in my Items collection.

  2. Eyup
    Admin
    Eyup avatar
    3867 posts

    Posted 06 Nov 2017 Link to this post

    Hi David,

    You can access the InsertItem using the following approach:
    GridEditableItem insertItem = RadGrid1.MasterTableView.GetInsertItem();
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Common/using-the--getitems-getcolumn-and-getcolumnsafe-methods#insert-item

    Alternatively, you can use the GetItems method:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Common/using-the--getitems-getcolumn-and-getcolumnsafe-methods#items

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. David
    David avatar
    13 posts
    Member since:
    Apr 2013

    Posted 06 Nov 2017 in reply to Eyup Link to this post

    Eyup,

    Thank you for your reply but I saw those posts before and they do not work for me. I believe it is because I am in the asp .net Button click procedure, trying to reference the grid's Items or EditItems and I am not in one of the grids functions like the example using the PreRender.

  4. Eyup
    Admin
    Eyup avatar
    3867 posts

    Posted 09 Nov 2017 Link to this post

    Hi David,

    In this case you can use a global condition flag variable and change it during the button event and then use it during PreRender.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top