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
90
UltraGrid GroupBy changes column/cell info breaks functions that extract data from it
posted

The UltraGrid GroupBy functionality is impressive! The problem is that it messes up later processing that retrieves data from cells in the grid which produces "object reference not set" and "index was out of range" exceptions. This is the code.

for (int i = 0; i < uGrid.Rows.Count; i++)
{
    Boolean value = (Boolean)uGrid.Rows[i].Cells[0].Value;
    if (value == true)
    {
        string action= (string)uGrid.Rows[i].Cells[2].Value;
        string item = (string)uGrid.Rows[i].Cells[3].Value;

        if (action == ADDED)
        {
               selectedItemList.Add(item);
        }
    }
}

If the checkbox in Cell[0] is checked (i.e. true) then it processes information in Cell[2] and Cell[3]. This works properly when the grid first displays. This doesn't happen simply by moving one column laterally. But when I change things around with GroupBy the errors occur.

Somehow the code needs to keep track of the grid changes after GroupBy changes. Any ideas on what grid events and properties are needed? I've tried a bunch of things but haven't figured it out yet.

Thanks in advance...