Sorting is another way to organize data. It can be either ascending or descending. FlexReport allows sorting through DataSource.SortDefinition. Let us suppose you want to display product details with their names in ascending order in the report created in Quick Start. For doing so, follow these steps to sort the product names in alphabetical order.
C# |
Copy Code
|
---|---|
bool asc; private void btnSortData_Click(object sender, EventArgs e) { if (asc) { SortDefinition sd = new SortDefinition("[Name]", SortDirection.Ascending); flexReport.DataSource.SortDefinitions.Add(sd); asc = false; } else { btnLoad.PerformClick(); asc = true; } } |