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
450
Problem moving row in grouped grid
posted

Hi.

I have problem moving row in grouped grid.

I use the function attached below in order to remove row, do some actions on the row (change text etc.)

and then returning the row to the grid. when I do it it returns to the last row so I use the move method in order to return the row back to it's place.

It works fine when the rows is not grouped but when the rows is grouped apparently the move should work on the group only but I can't get the last index of current group (I can us .Rows.IsGroupByRows to know if it's grouped).

Please help.

        //removing the current row and adding the new one.
        private static void removeAddRow(int newselectedIndex, string BR_ID)
        {
                int selectedRowIndex;
                selectedRowIndex = newselectedIndex;
                UltraGridRow row = frmBR.gridBR.ActiveRow;
                T_BR newTBR = clientFacade.getBRtranslated(user.WWID, BR_ID, selectedQT_ID);
                frmBR.tBRBindingSource.RemoveCurrent();
                frmBR.tBRBindingSource.Add(newTBR);
                try
                {
                    frmBR.gridBR.Rows.Move(frmBR.gridBR.Rows[frmBR.gridBR.Rows.Count - 1], selectedRowIndex);
                }
                catch (Exception)
                {
                    //Exception: Specified argument was out of the range of valid values. Parameter name: index
                }
            }
        }

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    The move method is on the Rows collection. When you group the grid, each GroupByRow creates a hierarchy with it's on collection of child rows. So you cannot just use grid.Rows, because once the grid it grouped, grid.Rows contains the GroupByRows, and each GroupRow has a set of child rows under that. So the code you have here is calling grid.Rows.Move and you are passing in a row that does not belong to the grid.Rows collection.

    You have to call rows.Move on the rows collection to which the row actually belongs.

     

     

Children
No Data