We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Heirarchical table format change issue

I have a two level heirarchical table which includes two tables(eg Table A and B(child)),

There I take any field(column) of table A and added summarycolumn for that.After that if i change the format of this parent table it works fine.

But in the case of inner table B,when i proceed with the same senario that i have done with parent table A,it fails to produce an output and throws an exception("Unable to cast object of type 'Syncfusion.Grouping.BooleanAggregateSummary' to type 'Syncfusion.Grouping.CountSummary'.
).

Please confirm, is it a missed functionality with syncfusion 4.4.0.51?



3 Replies

SR Sri Rajan Syncfusion Team July 14, 2008 09:17 AM UTC

Hi Nidhin,

Thank you for your continued interest in Syncfusion products.

Please refer the below code which shows you how to change Summary Column format of Parent and Child Tables.

DataTable parentTable = ParentTable();
DataTable childTable = ChildTable();
DataSet dSet = new DataSet();
dSet.Tables.AddRange(new DataTable[] { parentTable, childTable});
DataColumn parentColumn = parentTable.Columns["PID"];
DataColumn childColumn = childTable.Columns["PID"];
dSet.Relations.Add("ParentToChild", parentColumn, childColumn);
this.gridGroupingControl1.DataSource = parentTable;
this.gridGroupingControl1.Engine.BindToCurrencyManager = false; // don't attach this one to CurrencyManager.

GridSummaryColumnDescriptor scd1 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ParentValue", "{Sum:#}");
GridSummaryRowDescriptor srd1 = new GridSummaryRowDescriptor("Sum", "Total", scd1);
srd1.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd1.Appearance.AnyCell.BackColor = SystemColors.Info;

GridSummaryColumnDescriptor scd2 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ChildValue", "{Sum:#}");
GridSummaryRowDescriptor srd2 = new GridSummaryRowDescriptor("Sum", "Total", scd2);
srd2.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd2.Appearance.AnyCell.BackColor = SystemColors.Info;

this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows.Add(srd1); this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows.Add(srd2);

//Change the format here.
scd1.Format = "{Sum:##.0000}";
scd2.Format = "{Sum:##.00}";


Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F75103/main.htm

Please let me know if this helps.

Best Regards,
Srirajan.



AD Administrator Syncfusion Team July 15, 2008 04:35 AM UTC

Hi Srirajan,

Thankyou very much for the quick response.

I just went through the sample program for setting the summary rows. For m case the application works fine while adding the summary rows; but i get an invalid cast exception while changing the summary type of an already existing summary column descriptor. I'm pasting the psuedo code below,

GridSummaryColumnDescriptor sd = this.m_tableDescriptor.SummaryRows[0].SummaryColumns["OrderID"]

sd.SummaryType = SummaryType.BooleanAggregate;


Please let me know how to edit the summary type of an existing summary column descriptor.

Thanks in advance



SR Sri Rajan Syncfusion Team July 15, 2008 10:45 AM UTC

Hi Nidhin,

Thank you for your interest in syncfusion products.

Here is the code to change the summary type.

GridSummaryColumnDescriptor sd = this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows[0].SummaryColumns[0];
sd.SummaryType = SummaryType.DoubleAggregate;


Please let me know if this helps.

Best Regards,
Srirajan.



Loader.
Live Chat Icon For mobile
Up arrow icon