Interactive reports

RDLC reports enable developers to add interactive capabilities to reports. In this section, we will see how to add sorting buttons to the generated report and allow end users to sort the output by any of the report columns. To do this, we will modify the Customer Payment Dates report. The default report layout sorts the data by customer number. But probably users want to see the list sorted by customer name or the payment date instead; with RDL, we can give them this option. First, let's add sorting to the Customer No. column, which is our default sorting key:

  1. Right-click on the textbox containing the header of the first column: Customer No.. It is important that the sorting property is enabled on the header textbox, not the data field.
  2. Select Text Box Properties from the drop-down menu and choose the Interactive Sorting tab in the properties window.
  3. Enable the checkmark in the Enable interactive sorting on this text box field.
  4. In the Sort by field, select the name of the field that is going to be the sorting key: [CustomerNo].

The next screenshot illustrates the Text Box Properties window, where you can set up sorting parameters:

Setting up interactive sorting

Now, repeat the same steps for all the fields you want to use as sorting keys.

You can do data sorting based on an RDLC expression. Just click the expression button next to the Sort By field and enter the expression in the editor.

When the report is run, you will see a sorting button in the column headers (see the following screenshot). When you click on a button, the report output will be ordered by the respective column:

Report with sorting buttons

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset