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
mac_swit said: I can you give some more information. I have placed a new grid on the form, bound to a datasource like described above but only two binding sources. The grid has therefore 2 bands. Furthermore I have bound two ultraNumericEditor to the primary keys of the bands. Only changing the active row of the grid in the first band are reflected in the bound edit controls. The Id of the child rows is always the first row-Id. I'm using version 9.2.20092.2058. Is this a bug?
I can you give some more information. I have placed a new grid on the form, bound to a datasource like described above but only two binding sources. The grid has therefore 2 bands. Furthermore I have bound two ultraNumericEditor to the primary keys of the bands.
Only changing the active row of the grid in the first band are reflected in the bound edit controls. The Id of the child rows is always the first row-Id.
I'm using version 9.2.20092.2058. Is this a bug?
How are you binding the second UltraNumericEditor. My guess is that you are binding it to the child table in the DataSource and not to the Relationship, which is what really represents the child band.
All of this is handled by the BindingManager in DotNet, though, it's really nothing specifically to do with the NetAdvantage controls, so it's not a bug - unless the grid is somehow not synchronizing the position of the BindingManager. But that's been working fine for 10 years, so it's unlikely that it broke recently. :)
No I did not bound to the child data table. The BindingSource of Band[1] has the BindingSource of Band[0] as DataSource property and the relation (FK_Table2_Table1) as DataMember property defined. The NumericEditor is then bound to the ID-column of the BindingSource of Band[1].
I have found some discussions here about the problem:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1753
But implementing this, does not solve the problem. Selecting rows on band[1] are not reflected. My workaround is to set a filter on the binding source with the parent-ID in the Grid_AfterSelectChange event.
this.myBindingSource.Filter = string.Format( "AccountId = {0}", parentId );
Since I don't have the same situation in a other form or project, I can not compare. Maybe I setup a small test project to figure out. But for now I have wasted lot of time working on this and I use my workaround. If I have a test project I will send you this later.
Best Regards. Markus
I'm attaching a sample here that binds both a grid and an UltraNumericEditor to some child data.
I have modified your sample using BindingSources as I told you. Now you can see that selecting band[1] in grid1 does not reflect changes in grid2.
Can you explain me how to set the BindingSource properties DataSource and DataMember correctly that everything works. If I set the DataMember property as you did, I'm running into compile error "member not found in the source".
Best Regards
I'm not sure, you might want to check with Microsoft and see if they have a better solution. I can't claim to be an expert on the BindingSource.
The only way I could get this to work was to use the same BindingSource for all three controls:
this.bsParent.DataSource = this.ds; this.bsParent.DataMember = "Parent"; this.ultraGrid1.DataSource = this.bsParent; // Bind a Numeric Editor to the Price field in the child band. this.ultraNumericEditor1.DataBindings.Add("Value", this.bsParent, "Parent-Child.Price"); // Bind the child grid to the entire child list. this.ultraGrid2.SetDataBinding(this.bsParent, "Parent-Child");