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.
>Hi Manjesh,
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/F75049/main.htmPlease let me know if this helps.
Best Regards,
Srirajan.