I have a business object that inherits from IBindingList that is built to contain other custom collection which also inhertis IBindingList.
When the child collection is empty (collection initialized but not objects in the collection) is bound to the grid the child band is not initialized hence accessing grid.DisplayLayout.Band["ChildBand"] throw an exception.
Why is the child band not initialized with no rows ?
In addition, when the business object is updated to contain object sin the child collection will the child band be automatically initalized.
Hi,
This has nothing to do with the grid. The grid gets the data structure from the BindingManager in DotNet. My guess is that the BindingManager is attempting to get the data structure from the first row of data. If the first row in the parent list has no child items, then BindingManager will attempt to add one, get the structure, and then cancel the add.
So you might try implementing ITypedList which will give the BindingManager another way to get the structure. This hasn't worked very well for me in the past.
Another option would be to make sure the BindingManager can add and then cancel a new child item. This means implemented IEditableObject or ICancelAddNew.