I am trying to do a loop that goes through every row & executes code. Any help would be appreciated. I have never used the infragistics, but our software uses the controls..
Hi,
It's very difficult to answer your question without knowing more about yoru data structure, what you are trying to do, and what features of the grid you are using.
Usually, looping through rows in the grid is not a very efficient way to do things. If, for example, you want to apply a color to a cell or row based on a value in that row, you would be much better off using the InitializeRow event rather than looping through every row.
If you do actually need to loop, then you will want to use the grid's Rows collection. The collection itself contains only the root-level rows. So if you want rows on multiple levels, you will want to use one of the methods on this collection such as GetAllNonGroupByRows, GetFilteredInNonGroupByRows, GetFilteredOutNonGroupByRows, or GetEnumerator. Which one you use depends on many factors.
It is a Dataview with items from a single progress table. If it were better do do this using the DataView I would try. There is a cell that holds a value in each row. Each row is just a record with a few in the database, no children. I want to loop through each row copy that value to another cell in the same row.
Okay, if that works it's fine.
But it would be more efficient to use the InitializeRow event rather than looping through every row in the grid.
Turns out that it did not work so well. Although it was making changes at the UI, the changes did not seem to follow through to the DB. I am going to try using the DataView.
You probably just need to call the Update method on the row after you set the Value on the cell(s) in that row. Or call UpdateData on the grid after the loop completes to update all rows at once.
I'm using the ultra grid.
when I load the grid with data, I have set back color of each row according to a cell value . for that I have to iterate through the grid and set the backcolor property. Is there any way that I can do the same thing without iterating the grid since it takes so much of time?
Use the InitializeRow event. You can get the row from e.Row. Pay attention that the event occurs when the row is initialized and also when the user change a cell value. e.Reinitialize is the difference between the two cases.