Implement Sorting in Reports using Report Viewer


I have a Report with three columns - Name, Age, and Phone; I created using Reports Viewer in Visual Studio 2005, which looks like Figure 1.

Figure 1.  

See Reporting Services section to learn how to create reports using Reports Viewer. OR download the attached source code. 

Now I am going to implement sorting on Name, Age, and Phone columns.

Right click on the Name column, select Properties menu and click on Interactive Sort tab on the TextBox Properties dialog. Check Add an Interactive sort action to this textbox checkbox as shown in Figure 2. Select the field name, which you want this column to sort data on and click OK button.

 
Figure 2.

Now if you run the report, you will see little sort icons next to the column name and clicking on this icon will sort the data. See Figure 3.


Figure 3.

You can add sorting to rest of the columns in same way.


Similar Articles
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.