Back to Devexpress

Data Sorting in Reports V2

expressappframework-113595-shape-export-print-data-reports-data-sorting-in-reports-v2.md

latest2.3 KB
Original Source

Data Sorting in Reports V2

  • Feb 20, 2026

The following data sorting approaches are available in Reports V2.

  1. Use XtraReports sorting.
  2. Use the CollectionSourceBase.Sorting property of the CollectionDataSource or ViewDataSource (see Data Sources for Reports V2).
  3. Use ReportParametersObjectBase.GetSorting method of the Parameters Object (a ReportParametersObjectBase descendant).

Sorting Property of the Data Source

The CollectionSourceBase.Sorting property of the CollectionDataSource and ViewDataSource components specifies a list of sorting rules.

You can add rules by clicking the ellipsis button next to the Sorting value in the Properties window.

The data is sorted on the client side.

You can use the following code to modify Sorting from Report Scripts.

csharp
private void xtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    var report = (DevExpress.XtraReports.UI.XtraReport)sender;
    var dataSource = (DevExpress.Persistent.Base.ReportsV2.ISupportSorting)report.DataSource;
    dataSource.Sorting.Clear();
    dataSource.Sorting.Add(
        new DevExpress.Xpo.SortProperty("FullName", DevExpress.Xpo.DB.SortingDirection.Ascending));
}

Parameters Object

Sorting via the Parameters Object is performed in a manner similar to filtering. For details, refer to the Data Filtering in Reports V2 topic.