This example shows how to sort group rows by summary values, so that countries having the maximum sales amount appear on the top of the view.
The image below shows the result:
using DevExpress.Data;
using DevExpress.Web.ASPxGridView;
protected void Page_Load(object sender, EventArgs e) {
grid.GroupSummarySortInfo.Clear();
ASPxGroupSummarySortInfo sortInfo = new ASPxGroupSummarySortInfo();
sortInfo.SortOrder = ColumnSortOrder.Descending;
sortInfo.SummaryItem = grid.GroupSummary["Sales", SummaryItemType.Sum];
sortInfo.GroupColumn = "Country";
grid.GroupSummarySortInfo.AddRange(sortInfo);
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
grid.GroupSummarySortInfo.Clear()
Dim sortInfo As ASPxGroupSummarySortInfo = New ASPxGroupSummarySortInfo()
sortInfo.SortOrder = ColumnSortOrder.Descending
sortInfo.SummaryItem = grid.GroupSummary("Sales", SummaryItemType.Sum)
sortInfo.GroupColumn = "Country"
grid.GroupSummarySortInfo.AddRange(sortInfo)
End Sub
<dxwgv:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" DataSourceID="AccessDataSource1" KeyFieldName="OrderID" Width="100%">
<Columns>
<dxwgv:GridViewDataColumn FieldName="CompanyName" VisibleIndex="2" />
<dxwgv:GridViewDataColumn FieldName="City" VisibleIndex="3" />
<dxwgv:GridViewDataColumn FieldName="Region" VisibleIndex="4" />
<dxwgv:GridViewDataColumn FieldName="Country" GroupIndex="0" VisibleIndex="5" />
<dxwgv:GridViewDataColumn FieldName="Sales" VisibleIndex="6" />
</Columns>
<GroupSummary>
<dxwgv:ASPxSummaryItem FieldName="Sales" SummaryType="Sum" DisplayFormat="{0:c}"/>
</GroupSummary>
</dxwgv:ASPxGridView>