Hi Guys,
I have some DataTables - which have relations between them. I would like to build an hierarchical UltraDataSource from them.
I'm a ware to the fact that this data tables should be converted by iterating over the rows and inserting them into the UltraDataSource.
What i don't get is how to define the relationships, for example in DataSet can set Relations between columns of the data tables columns simply by dataSource.Relations.Add(columnsTableA, columnsTableB).
I want to know how to do it with UltraDataSource. I want to deine the bands and the relations between those bands.
For example in DataSet i do:
var relationX = new DataColumn[]{table0.Columns["C1"]} var relationY = new DataColumn[]{table1.Columns["C2"]}; ds.Relations.Add(relationX, relationY);
And this sets the hierarchical structure.
Actually i'm trying to convert an hierarchical dataset into UltraDataSource with no success.
Can you help - do you guys have a procedure for this - or something that would help?
Help will be appriciated much!
BTW: I want to convert it to UltraDataSet since it has the LoadOnDemand feature.
Thanx, Gili
That sounds a bit odd. But I imagine what youy would do is use the InitializeRowsCollection event and refer to the parent row and ask for the data. that should trigger the CellDataRequested for the parent row and thus provide the data you need on-demand.
Hi Mike,
While trying to combine hierarchical data with load on demand, I stumbled upon a strange sequence of events.
Namely, the InitializeRowsCollection for the children rows of the first parent row is triggered before the CellDataRequested for the first parent row - meaning that InitializeRowsCollection cannot depend on values of the parent row being set!
While I can work around this behavior, would not it be more consistent to fire InitializeRowsCollection for the first collection only on expansion (as is done for the children of all other parent rows)?
Thanks in advance,
Andris
Hi Gili,
UltraDataSource does not calculate the relationships like a DataSet. UltraDataSource is essentially a tree structure. If you were going to copy your data set into an UltraDataSource, you would basically add the root level rows, and then under each parent row you would add the child rows.
However, if you are planning to load the data on-demand, then copying the actual row data up front doesn't really make sense. What you should do is just set up the bands and columns and then handle events like CellDataRequested to actually populate the UltraDataSource with data.