expressappframework-113595-shape-export-print-data-reports-data-sorting-in-reports-v2.md
The following data sorting approaches are available in Reports V2.
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.
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));
}
Sorting via the Parameters Object is performed in a manner similar to filtering. For details, refer to the Data Filtering in Reports V2 topic.