I have a multiband grid and bound the grid.DataSource to a bindingSource. The grid rows are displayed in correct hierachical form.
My grid would display band[0] to band[3]. For layout reasons I like band[2] and band[3] data display in other controls on my form. For every band (=dataTable) I have a bindingSource with dependencies over foreign key relation in my dataSet and I use this for the bindingSource.DataMember. Everything like it should be, I guess.
But if I select grid child rows in band[1] my dependent data are not displayed corresponding to the grid row.
Do I need assign the bindingSource assign to the grids band[1]? I looked for a property such like grid.displayLayout.Bands[1].dataSource but this is not possible.
Thanks for any help.
Markus
Hi Markus,
The DotNet BindingManager will handle this for you automatically, as long as the controls are bound property to the correct data sources and as long as all of the controls have the same BindingContext.
By default, the controls get their BindingContext based on their containing control. So if all of the controls are in the same container, then you probably just have to mess around with the bindings a little. I don't think we have any documentation on this, since it's really nothing to do with our controls, specifically, but Microsoft must document this somewhere.
Hello Mike,
The data structure has 4 bands. The top two bands are displayed in the first grid in Multiband mode. Band[2] ist displayed in a SingleBand Grid and Band[3] is displayed in another SingleBand grid.
Every Grid is in a seperate UltraGroupBox but in the same Form. The grids are bound to a DataSet with 4 tables and I use 4 BindingSources with relations specified. This should be ok, since I did not have had any problems with this part so far.
But, to reflect dependencies in the depending grids I must use a piece of code like this:
long parentId = 0; if ( this.GridAccLink.ActiveRow.Band.Index == 1 ) parentId = (long)this.GridAccLink.ActiveRow.Cells["AccountLinkDefId"].Value; this.bsAccountOperation.Filter = string.Format( "AccountLinkDefId = {0}", parentId ); this.GridOperation.Refresh();
Is the containing control the problem or di I miss something else?
Regards. Markus