I see two different solutions:
1) perform data management manually:
a) sort data by pseudo-group column; b) view the sorted list of data, calculate the final values โโmanually, and finally show this value;
2) create a new grid on the page, associate it with data, a group by the required column, get the final values โโand, finally, dispose of it.
I have not tested the second approach, but I see no reason why this approach should not work.
UPDATE
Only the final value can be set if you use your own resume. This can be done in the CustomSummaryCalculate event handler. You can also use the following code to get summary values:
double total = 0; for(int i = 0; i < ASPxGridView1.VisibleRowCount; i ++) { total += Convert.ToDouble(ASPxGridView1.GetGroupSummaryValue(i, someSummaryItem)); }
You should implement something like this.
Update 2 Okay, I think I found the most effective solution to this problem. Let me explain. First, you must use your own resume, as explained in the User Summary . Using the CustomSummaryCalculate event handler, it is necessary to collect data into a Dictionary object, whose key contains the value of the Customer_No field, the value is a list of price values โโfor this Client. Finally, you need to calculate the final resume. Below is the full code, both ASPx and C #. Hope this will be helpful for you.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" OnCustomSummaryCalculate="ASPxGridView1_CustomSummaryCalculate"> <TotalSummary> <dx:ASPxSummaryItem FieldName="Price" SummaryType="Custom" ShowInColumn="Price" /> </TotalSummary> <Settings ShowFooter="True" /> </dx:ASPxGridView>
...
using System; using System.Collections.Generic; using System.Data; using System.Collections; protected void Page_Init(object sender, EventArgs e) { ASPxGridView1.DataSource = GetDataSource(); ASPxGridView1.DataBind(); } private object CreateDataSource() { DataTable table = new DataTable(); table.Columns.Add("Customer_No", typeof(int)); table.Columns.Add("Price", typeof(int)); table.Rows.Add(new object[] {123, 50 }); table.Rows.Add(new object[] {123, 100 }); table.Rows.Add(new object[] {123, 60 }); table.Rows.Add(new object[] {124, 60 }); table.Rows.Add(new object[] {125, 20 }); table.Rows.Add(new object[] {125, 40 }); return table; } private object GetDataSource() { if(Session["data"] == null) Session["data"] = CreateDataSource(); return Session["data"]; } Dictionary<int, List<int>> dict; protected void ASPxGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { if(e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start) dict = new Dictionary<int, List<int>>(); if(e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate) { int customer_No = Convert.ToInt32(e.GetValue("Customer_No")); List<int> list; if(!dict.TryGetValue(customer_No, out list)) { list = new List<int>(); dict.Add(customer_No, list); } list.Add(Convert.ToInt32(e.GetValue("Price"))); } if(e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) { e.TotalValue = CalculateTotal(); } } private object CalculateTotal() { IEnumerator en = dict.GetEnumerator(); en.Reset(); float result = 0; while(en.MoveNext()) { KeyValuePair<int, List<int>> current = ((KeyValuePair<int, List<int>>)en.Current); int sum = 0; for(int i = 0; i < current.Value.Count; i++) sum += current.Value[i]; result += sum / current.Value.Count; } return result; }