I have a Business object "Parent" that has a collection of another Business object called "Child". It also has some properties and methods as usual. Now this is how i try to bind this to an UltraWinGrid:
1. Populate "Parent" instance called "p" by assigning some values to its properties.
2. Declare a Bindingsource "bndSource" at runtime.
3. Set binding source DataSource as bndSource.DataSource = p;
4. Set binding source of ultrawingrid to be mygrid.Datasource = bndSource.
5. Run.
As control passed through step 4, the entire form goes white in color and does nothing until I abruptly end the process.
Note: The "Parent" class has some properties (some readonly, some are of datatype guid, some are inherited), some methods and a collection of objects of type "child".
Note: This class is generated using Nettiers templates.
Hi,
The grid needs to be bound to an IList or an IBindingList. So are you binding the grid to a list of Parent objects, or a single object? I don't think a single parent object will work, but you could create a BindingList<Parent>, add a single parent object to the list and bind the grid to that.
Having said that, I'm not sure why the whole form locks up. Binding the grid to a single object should not cause that. That's more likely to happen if you bind the grid to a recursive data source. Does your Child object also have a collection of Child objects? If so, then you probably need to limit the grid's depth. Try setting MaxBandDepth on the grid.DisplayLayout to something like 5 and see if that fixes the issue.
Mike,
Setting MaxBandDepth property to 3 now does not hang the form now and it also shows up the data on the grid. Thanks for your help.
For your question about the parent if its a collection or a single, the answer is, the parent is a single object to which the grid is bound. Now this Parent is assigned to a BindingSource Control's datasource which itself has the IBindingList implementation. Hence I assume there won't be any problem in using a single parent object.
Scott.