Hello,
I need to get a number of group rows in the grid view. The RowCount property provides a total number of rows including data rows and group rows no matter whether group rows are collapsed or expanded. Now, i need to run through all data rows and i didn't find a better way than going from 0 to RowCount and operate the index like it is row handle. However, when i have groups at the end of the iterating i have to check whether the handle is valid. In some cases i need to interate through group rows in the same way and there i'm running from -1 back until i get invalid row. Is there any more conventional way that provides total number of group rows?
Regards, Leo
We have closed this ticket because another page addresses its subject:
Count group rows
Hello Leo,
You can use this function to obtain a group row count:
private static int GetGroupRowCount(DevExpress.XtraGrid.Views.Grid.GridView view) { for(int i = -1; i >= int.MinValue; i--) { if(!view.IsValidRowHandle(i)) return -(i + 1); } return 0; }
Thanks,
Nick
Thank you. In other words there is no such information. I'd already discovered the suggested trick, but i's hoping that the value exist and doesn't require tricks. :(
Leo.
Hello Leo,
This is a recommended solution. I believe that this solution is not so complex to provide an additional method for the grid.
Thank you,
Paul