This sample demonstrates adding summaries through code. The summaries that are set for the top table are sufficient enough to create summaries in groups.
Features:
To create summaries through code:
Create an instance of the GridSummaryColumnDescriptor specifying the summary type, summary column, and format type.
Create an instance of GridSummaryRowDescriptor by passing the GridSummaryColumnDescriptor object.
GridSummaryRowDescriptor object can be added to the GridSummaryRowDescriptorCollection for the required table.
// Adding Summaries for the Details Table. GridSummaryColumnDescriptor scd = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "Quantity", "{Sum:#}"); GridSummaryRowDescriptor srd = new GridSummaryRowDescriptor("Sum","Total", scd); srd.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right; srd.Appearance.AnyCell.BackColor = SystemColors.Info; this.gridGroupingControl1.GetTableDescriptor("Order Details").SummaryRows.Add(srd);