In order to use the built-in parameters area of the report, we would need to create a report Parameter that lists the column names. We can do that by creating a Business object that holds this for us:
public class ColumnSelector : DataTable
this.Rows.Add("Email Address", "EmailAddress");
this.Rows.Add("Not Sorted", "Not Sorted");
The last row is added simply for the sake of being able to show the report data unsorted if needed. We set the DisplayMember property of the parameter to displayText column and ValueMember to sortColumn column. Of course we should not forget to set the Visible property of the Report Parameter to true in order to show the parameter area above the ReportViewer.
Now is time to set the actual sorting:
Subscribe to be the first to get our expert-written articles and tutorials for developers!