Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
75103 | Jul 14,2008 04:28 AM UTC | Jul 15,2008 10:45 AM UTC | WinForms | 3 |
![]() |
Tags: GridControl |
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}";
GridSummaryColumnDescriptor sd = this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows[0].SummaryColumns[0];
sd.SummaryType = SummaryType.DoubleAggregate;
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
or the page will be automatically redirected to sign-in page in 10 seconds.