How to: Sort Groups by Summary Values

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) {

    ASPxGroupSummarySortInfo sortInfo = new ASPxGroupSummarySortInfo();
    sortInfo.SortOrder = ColumnSortOrder.Descending;
    sortInfo.SummaryItem = grid.GroupSummary["Sales", SummaryItemType.Sum];
    sortInfo.GroupColumn = "Country";