Articles in this section
Category / Section

How to add summary row in GridControl?

1 min read

The GridControl doesn’t 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.

 

Code Snippet

C#

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;

 

VB

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 Link:

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)
Please sign in to leave a comment
Access denied
Access denied