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
2077
Redraw issue for the children rows of the first row in the first band of a multiband grid
posted

Hi,

I have encountered the following issue: I have a grid with two bands in it. It is bound to a UltraDataSource with two bands: the root band is called UnitateBand and the child band is called GestiuneBand. When I first populate the grid, it is drawn ok, with the correct number of children rows for each root row.

When I am repopulating the grid I'm trying to reset the count of the each children row collection for each root row to the new value. It works fine for the children rows of the root bands except for the first row. In its case the number of children rows is not changing, so if a new child is available a child row is hidden, depending on the sorting. When a child row is deleted an empty row is shown in the grid. For the root rows with index greater than 0, the issue is not manifesting.

The code I'm using to populate and repopulate the grid is:

public void SetUnitatiGestiuni(List<BOUnitate> listaUnitati, List<BOGestiune> listaGestiuni)

{

    Func func = delegate

        {

            // set the number of root rows which will contain unitati

            _unitatiGestiuniDataSource.Rows.SetCount(listaUnitati.Count);

            int contorUnitati = 0;

            foreach (BOUnitate unitate in listaUnitati)

            {

                UltraDataRow dataRow = _unitatiGestiuniDataSource.Rows[contorUnitati];

                dataRow["Id"] = unitate.Id;

                dataRow["Cod"] = unitate.Cod;

                dataRow["Denumire"] = unitate.Denumire;

                // find the available gestiuni for the curent unitate

                // and add them to the child band

                List<BOGestiune> gestiuniTemp = listaGestiuni.FindAll(

                    delegate(BOGestiune gestiune) { return gestiune.CodUnitate == unitate.Id; });

                UltraDataRowsCollection childRows = dataRow.GetChildRows("GestiuneBand");

                childRows.SetCount(gestiuniTemp.Count);

                int contorGestiuni = 0;               

                foreach (BOGestiune gestiune in gestiuniTemp)

                {

                    UltraDataRow childDataRow = childRows[contorGestiuni];

                    childDataRow["Id"] = gestiune.Id;

                    childDataRow["Cod"] = gestiune.Cod;

                    childDataRow["Denumire"] = gestiune.Denumire;

                    childDataRow["Tip"] = gestiune.TipGestiune.Denumire;

                    childDataRow["FormaEvidenta"] = gestiune.FormaEvidenta.Denumire;

                    childDataRow["SeFactureaza"] = gestiune.SeFactureaza; 

                   childDataRow["SeVindeCasaDeMarcat"] = gestiune.SeVindePrinCasaDeMarcat;

                    childDataRow["ModDeschidere"] = gestiune.ModDeschidere.Denumire;

                    contorGestiuni++;

                }

                contorUnitati++;

            }

            // make sure all unitati and gestiuni are visible

            gridUnitatiGestiuni.Rows.ExpandAll(true);

        };

    Invoke(func);

}

The comments have been translated to english, and I've tried to keep the romanian meaning.

Am I doing something wrong, or is this a bug?

Parents Reply Children