This is a migrated thread and some comments may be shown as answers.

Master/Detail tables and aggregates problem

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 16 Sep 2010, 07:26 PM
I have a master table with a single detail table within it.  The master table has it's columns set up with aggregates, the detail table does not.  The data source for the master table is different than that of the detail table, though both datasources have the same structure.  The master and detail tables are not set to use Grouping or Hierarchy explicitly.

The master table shows its footer and properly shows any text I have set per column using the FooterText property.  It also shows the proper text for the aggregate, for example it shows "Sum:" if I set the Aggregate property to Sum.  But it does not show the actual number result of the aggregation.  If I take out the detail table, it does.

Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Louis
Top achievements
Rank 1
answered on 16 Sep 2010, 09:15 PM
I figured this out.  In my code behind I was taking a single Linq data source and binding it to the master grid and detail grid while doing some filtering on the data source.

myGrid.MasterTableView.DataSource = linqSource.Reverse().Skip(linqSource.Count - 1);
myGrid.MasterTableView.DetailTables[0].DataSource = linqSource.Skip(1);

Everything seemed fine except for the footer aggregates problem.

I changed the code to create one new collection for the master table and use the original source for the detail table.

Collection<myObjects> root = new Collection<myObjects>();
root.Add(linqSource.First());
myGrid.MasterTableView.DataSource = root;
myGrid.MasterTableView.DetailTables[0].DataSource = linqSource.Skip(1);


And now the aggregates show up fine.
Tags
Grid
Asked by
Louis
Top achievements
Rank 1
Answers by
Louis
Top achievements
Rank 1
Share this question
or