Articles in this section

How to add summary row in WinForms GridControl?

The GridControl doesnot support summaries by default. If you want to implement the summary row, use the FormulaCell cell type and set the formula to summarize the values.

 

For example, in the below sample, the customized summary row is added in the 10th row of the GridControl.

this.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(10, 4, 10, 5));
this.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(10, 1, 10, 3));
this.gridControl1[10, 4].CellType = GridCellTypeName.FormulaCell;
this.gridControl1[10, 4].Text = string.Format("=Sum({0}{1}:{0}{2})", GridRangeInfo.GetAlphaLabel(1), this.gridControl1.TopRowIndex, this.gridControl1.RowCount - 1);
this.gridControl1[10, 1].Text = "Total value for first column";
this.gridControl1[10, 1].Font.FontStyle = FontStyle.Bold;
Me.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(10, 4, 10, 5))
Me.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(10, 1, 10, 3))
Me.gridControl1(10, 4).CellType = GridCellTypeName.FormulaCell
Me.gridControl1(10, 4).Text = String.Format("=Sum({0}{1}:{0}{2})", GridRangeInfo.GetAlphaLabel(1), Me.gridControl1.TopRowIndex, Me.gridControl1.RowCount - 1)
Me.gridControl1(10, 1).Text = "Total value for first column"
Me.gridControl1(10, 1).Font.FontStyle = FontStyle.Bold

Summary Row in GridControl:

Showing summary row in GridControl

 

Sample Links:

C#: SummaryRow_C#

VB: SummaryRow_VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied