Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Errors accessing Table rows when Group Columns enabled
posted

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.

Parents
  • 265
    posted

    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.

Reply Children
No Data