I'm having a weird problem or problems. My Grid contains records and I can access the rows individually without any problems.
Example: if (gridTable.Rows[indexVar].Cells == null) ...
But as soon as I turn on Group Columns and try accessing rows in the grid, I get "object not set" for the above line of code. I also get invalid index.
Am I suppose to be navigating the table using a different collection of objects when the Group Columns is enabled? Or is there something I am not understanding about the re-arrangement of the grid and table rows when Grouping is turned on?
I am perplexed.
Hello ,
Based on the description of your case it seems that you are enabling OutlookGrupBy with grid1.DisplayLayout.ViewType = ViewType.OutlookGroupBy;. So when OutlookGrupBy is enabled and there is a column/s on which grid was grouped, then its rows become GroupByRow (you could check this with Is GroupByRow property http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v12.2~Infragistics.Win.UltraWinGrid.UltraGridRow~IsGroupByRow.html ).
In this case in order to aces the data rows which are part of that group you should cast the row to UltraGroupByRow and access its Rows collection
http://help.infragistics.com/Help/Doc/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridGroupByRow~Rows.html
N.B. please note that rows of GroupByRow also could be a GroupByRow depends on the number of columns to which you have had grouped your grid.
Please let me know if you have any further questions.
FOR EXAMPLE:
When Group Columns is turned OFF, the following line of code works just fine:
if (gridTable.ActiveRow.Index == -1 || gridTable.Rows[gridTable.ActiveRow.Index].Cells == null) return;
But if I turn on Group Columns, then I get the following error:
"IndexOutOfRangeException" and this points to the value of .ActiveRow.Index in the 2nd half. The value is 4 but the collection of Cells is reportedly 3. That's not right because my sub-grid (if that's what I can call it) has 8 rows. I click on row 5 which is Index 4 and that's when I get the silly error about the IndexOutOfRange. NOTE: MY COLUMN GROUPING HAS CREATED 3 GROUPS.
Doesn't make sense to me.