In my ASPxGridView
,
I getting total simply IPOTEK
column in footer with this code;
<TotalSummary>
<dx:ASPxSummaryItem FieldName="IPOTEK" SummaryType="SUM" ShowInGroupFooterColumn="IPOTEK" DisplayFormat="n0" />
</TotalSummary>
And i getting average value of IPOTEK
column when i grouping in Group's footer.
<GroupSummary>
<dx:ASPxSummaryItem FieldName="IPOTEK" SummaryType="AVERAGE" ShowInGroupFooterColumn="IPOTEK" DisplayFormat="n0" />
</GroupSummary>
Everything is OK. For example when i grouping with, it looks like this; (IPOTEK
column is starting 109.827)
What i want is; in TotalSummary
, only total of GroupSummary
values for IPOTEK
column.
Rigth now, for this data adding TotalSummary
value 109.827
* 3
= 329.481
(GroupSummary * 3)
What i want, for this data adding only and only GropupSummary
value to TotalSummary
.
How can i do that?
Best Regards, Soner
Well, there is no a straightforward solution to this task. I see two alternatives:
1) use a custom summary for the footer summary and at the stage of the DevExpress.Data.CustomSummaryProcess.Finalize try to run through all group rows, obtain the corresponding summary values and sum them. To run through group rows, use the following code:
protected void ASPxGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) {
if(e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) {
ASPxGridView grid = sender as ASPxGridView;
double total = 0;
for(int i = 0; i < grid.VisibleRowCount; i++)
if(grid.IsGroupRow(i))
total += Convert.ToDouble(grid.GetGroupSummaryValue(i, grid.GroupSummary[0]));
e.TotalValue = total;
e.TotalValueReady = true;
}
}
2) use a label within the column's FooterTemplate container and handle the GridView's PreRender and BeforeGetCallbackResult to set this label value. The value should be calculated using the code above.
I hope, this helps.
UPDATE
why are using this code:
if (grid.IsGroupRow(7))
7 is a visibleRowIndex, you should pass the i parameter there