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. Image for the cookie policy date
close icon

Grouping grid - Summary column

7.4.0.20 Windows vs2008 c#

I have a grid (as an example)
Column B = a potential Value
Column C = Percentage based on performance
Column D = B * C

These values are figured in code and the grid just simply shows what is already figured out.

In the summary, it is slightly different
Column B just needs to be sum the total values.
Column D needs to be summed too.

These two columns work.

Column C summary should be a division
"Column D summaray" / "Column B summary"

How can I accomplish this?

Here's some sample data:
20000 0.86 17200
300000 0.72 216000

Summary should be this:
320000 0.72875 233200




1 Reply

JJ Jisha Joy Syncfusion Team April 1, 2011 06:44 AM UTC

Hi Mike,

Thank you for using Syncfusion products.


You need to handle the QueryCellStyleInfo event to achieve the desired behavior.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{

if (e.TableCellIdentity.TableCellType == GridTableCellType.SummaryEmptyCell && e.TableCellIdentity.ColIndex==5)
{
double d;
double d1;
string s1 = GridEngine.GetSummaryText(this.gridGroupingControl1.Table.TopLevelGroup, sum1);
string s2 = GridEngine.GetSummaryText(this.gridGroupingControl1.Table.TopLevelGroup, sum2);
double.TryParse(s1, out d);
double.TryParse(s2, out d1);
e.Style.Text = Convert.ToString((d /d1));
}
}

Please refer to the attached sample.

Regards,
Jisha






GGCSummaryAndExpression_c56cc9e8.zip

Loader.
Live Chat Icon For mobile
Up arrow icon