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

Looping through all rows in RadGrid

3 Answers 442 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 31 Oct 2017, 09:16 PM

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.

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 06 Nov 2017, 07:00 AM
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.
0
David
Top achievements
Rank 1
answered on 06 Nov 2017, 02:37 PM

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.

0
Eyup
Telerik team
answered on 09 Nov 2017, 02:44 PM
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.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Eyup
Telerik team
David
Top achievements
Rank 1
Share this question
or