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
140
InitializeRow not called when band is hidden
posted

I have a situation that works fine when using windows databinding, however I am not using WindowsDatabinding.

 I have a hierarchail data source that is a BindingList<Part> each object in this list has a sub list, also BindingList<T> that contains Unit of Measure objects.

I do the following code in InitalizeRow even handler:

foreach (IGridBandExpression bandExpression in _properties)
            {
                if (e.Row.Band.Key != bandExpression.BandKey) continue;

                foreach (var property in bandExpression.Properties)
                {
                    if (property.UseChildBandForValueList)
                    {
                        ValueList valueList = new ValueList();

                        if (e.Row.ChildBands != null)
                        {
                           
                            foreach (var row in e.Row.ChildBands[property.ChildBandName].Rows)
                                valueList.ValueListItems.Add(row.Cells[property.ValueListColumnKey].Value);

                            e.Row.Cells[property.ColumnName].ValueList = valueList;

                        }
                    }
                }
            }

 This code basically loops through my list of properties that I have defined for the Grid Control and when it gets to a row that is supposed to use a child band for a value list, it creates it. Nothing fancy, and it works, until i set the childBand.hidden = true in InitializeLayout. It does load the value list object from the child band for objects that are in the list when the control is bound.

Now the parent band contains Part objects. When you pick a new part from the drop down list in the PartNumber column, this triggers an event to load the part information, including the ChildList of UOM objects. The list is populated but the child band never gets the data when it is hidden.

 Any ideas?