Skip to main content

How to: Sort Data Against Two or More Columns

The following example sorts data by two columns in a Grid View. The code is enclosed within calls to the ColumnView.BeginDataUpdate and BaseView.EndDataUpdate methods. This speeds up performance by sorting the data only once, after the BaseView.EndDataUpdate method is called.

    gridView1.BeginDataUpdate();
    try {
        gridView1.ClearSorting();
        gridView1.Columns["Trademark"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
        gridView1.Columns["Model"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
    }
    finally {
        gridView1.EndDataUpdate();
    }