We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding a Formula on a Summary column by programmation

Thread ID:





73970 May 27,2008 02:58 PM UTC May 29,2008 12:33 PM UTC WinForms 4
Tags: GridControl
Gilles Carreau
Asked On May 27, 2008 02:58 PM UTC


I am using a GridGroupingControl
I have 3 column


I put a Summary column on the SalesPrice and AmountAlreadyCharge column

What I would like to do for the AlreadyChargePourcentage column is to take the total the AmountAlreadyCharge column divide by the total of the SalesPrice column

How can I do that by programmation?
Is that possible?

Thanks in advance and have a nice day!

Administrator [Syncfusion]
Replied On May 28, 2008 01:02 PM UTC

One way you can do this is to add a 'placeholder summary' where you want to see the custom calculation. Then handle the QueryCellStyleInfo event and explicitly provide the value of this placeholder summary at the proper time. Here is a minimal sample that shows this technique.

Gilles Carreau
Replied On May 28, 2008 08:44 PM UTC


I try to use your code sample in my project
It look like i dont have the right version of the grouping control

Is that possible ?
My version is

Does your sample should work with this version?

This line does not pass the compilation
TypeOf e.TableCellIdentity.DisplayElement Is GridSummaryRow

The compiler say that a DisplayElement can never be a gridSummaryRow

What do you think?

Thanks in advance

Administrator [Syncfusion]
Replied On May 28, 2008 10:25 PM UTC

I am using, the latest version.

Here is a VB snippet that works for me with the version.

Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
'If TypeOf e.TableCellIdentity.DisplayElement Is GridSummaryRow AndAlso Not (e.TableCellIdentity.SummaryColumn Is Nothing) AndAlso e.TableCellIdentity.SummaryColumn.Name = "sumCol1" Then
If Not (e.TableCellIdentity.SummaryColumn Is Nothing) AndAlso e.TableCellIdentity.SummaryColumn.Name = "sumCol1" Then

Dim row As GridSummaryRow = e.TableCellIdentity.DisplayElement '

e.Style.BackColor = Color.LightGoldenrodYellow
Dim dCol2, dCol3 As Double
If Double.TryParse(GridEngine.GetSummaryText(row.ParentGroup, "sumRow", "sumCol2"), dCol2) And Double.TryParse(GridEngine.GetSummaryText(row.ParentGroup, "sumRow", "sumCol3"), dCol3) And Math.Abs(dCol3) > 0.0000001 Then
e.Style.CellValue = dCol2 / dCol3
End If
End If
End Sub 'gridGroupingControl1_QueryCellStyleInfo

Gilles Carreau
Replied On May 29, 2008 12:33 PM UTC


I already try this code yesterday
Like I said it does not pass the compilation

I have an old version of the grid Syncfusion
so that might be the problem

Anyway I want to thank you for your support

Have a nice day!


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon