I've been combing documentation, the API's and this forum, but I am coming up a little short for my situation.
I have a DataSet with 3 DataTables.
ParentDataTable
ChildOneDataTable
ChildTwoDataTable
Each ChildDataTable is tied back to the ParentDataTable with a relation.
I would like to specify to show the the data in a heirarchical view between the ParentDataTable and ChildTwoDataTable.
I am setting the WebGrid.DataSource property in the code behind and then calling the DataBind Method.
How do I specify to show two bands and bind to the appropriate datatables in the dataset?
The version I'm using is NetAdvantage 3.5.
Is ChildTwoDataTable directly related to ParentDataTable, or is the relationship indirect, with ChildTwoDataTable directly related to ChildOneDataTable which in turn is directly related to ParentDataTable?
If the relationship is direct, or if you are willing to show the intermediate table, you can do something like this:
http://forums.infragistics.com/forums/p/3298/17902.aspx#17902
If the relationship is indirect, and you need to not show the middle table, I would sugest that you combine the two ChildTables into one denormalized table in your datasource.
Both ChildOneDataTable and ChildTwoDataTable are directly related to the ParentDataTable.
Ideally, I would like to instruct the Grid to create a band for ParentDataTable and ChildTwoDataTable before the DataBind (There may be times in the future where I would like to Bind to ParentDataTable and ChildOneDataTable and not display ChildTwoDataTable).
In a perfect world, I would expect this to work:
(C#)
revenueCalculationsUltraWebGrid.Bands.Clear();
Infragistics.WebUI.UltraWebGrid.UltraGridBand yearUltraGridBand =
new Infragistics.WebUI.UltraWebGrid.UltraGridBand(true);
yearUltraGridBand.BaseTableName = "ParentDataTable";
revenueCalculationsUltraWebGrid.Bands.Add(yearUltraGridBand);
Infragistics.WebUI.UltraWebGrid.UltraGridBand detailsUltraGridBand =
detailsUltraGridBand.BaseTableName = "ChildTwoDataTable"; revenueCalculationsUltraWebGrid.Bands.Add(detailsUltraGridBand);
elamberton said:revenueCalculationsUltraWebGrid.Bands.Clear(); Infragistics.WebUI.UltraWebGrid.UltraGridBand yearUltraGridBand = new Infragistics.WebUI.UltraWebGrid.UltraGridBand(true); yearUltraGridBand.BaseTableName = "ParentDataTable"; revenueCalculationsUltraWebGrid.Bands.Add(yearUltraGridBand); Infragistics.WebUI.UltraWebGrid.UltraGridBand detailsUltraGridBand = new Infragistics.WebUI.UltraWebGrid.UltraGridBand(true); detailsUltraGridBand.BaseTableName = "ChildTwoDataTable"; revenueCalculationsUltraWebGrid.Bands.Add(detailsUltraGridBand);
Using the designer does not meet my requirement of being able to switch out which child band I can see at run time (I would like that to be based on user preference).
elamberton said:Using the designer does not meet my requirement of being able to switch out which child band I can see at run time (I would like that to be based on user preference).
WombatEd said:You would have to do the same in code, implementing a different band(1) for each Child table.
So basically going through the following example:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/Infragistics2.WebUI.UltraWebGrid.v8.1~Infragistics.WebUI.UltraWebGrid.UltraGridBand.html
elamberton,
Yuk. I don't think you will have to create a gid band by band, row by row, cell by cell using code.
You just have to pick which tables your active relationship will be based on. It would probably be very confusing to the customer to have anything like two 'plus' expansion choices anyway.
Look at the way Microsoft Access does it and try that concept. Your problem is not technical but instead and interface issue. See my previous post for a potential solution.
I just would not run off and kluge a solution.