ReportViewer is a freely redistributable control that enables embedding reports in applications developed using the .NET Framework. Reports are designed with drag-and-drop simplicity using Report Designer included in Visual Studio 2010.
See screenshots of some applications that have ReportViewer control embedded in them.
The ReportViewer control offers the following benefits:
Processes data efficiently. The reporting engine built into ReportViewer can perform operations such as filtering, sorting, grouping and aggregation.
Supports a variety of ways in which to present data. You can present data as lists, tables, charts and matrices (also known as crosstabs.)
Adds visual appeal. You can specify fonts, colors, border styles, background images etc to make your report visually appealing.
Enables interactivity in reports. You can have collapsible sections, document map, bookmarks, interactive sorting etc in your report.
Supports conditional formatting. You can embed expressions in the report to change display style dynamically based on data values.
Supports printing and print preview.
Supports export to Excel, Word and PDF formats. (Word export in Visual Studio 2010 and up.)
The control can process and render reports independently using a built-in engine ('local mode') or it can display reports that are processed and rendered on a Report Server ('remote mode').
There is a WinForms and a WebForms version of the control.
Q: What are the new features in ReportViewer 2010?
A: ReportViewer 2010 supports RDL 2008 features such as Tablix, Rich Text and Gauges. Other enhancements include support for ASP.NET AJAX.
Q: Is the ReportViewer control included in SQL Server?
A: No. Report Server is a component of SQL Server, but the ReportViewer control is not. ReportViewer is only included in Visual Studio 2005/2008/2010.
Q: Does SQL Server have to be installed in order to use the ReportViewer control?
A: No. The only prerequisite of the ReportViewer control is .NET Framework.
Q: Is a SQL Server license required to use the ReportViewer control?
A: No. The ReportViewer control is freely redistributable. It can work independently of SQL Server ('local mode') and a SQL Server license is not required. In remote mode the ReportViewer control talks to a Report Server. The Report Server does require a SQL Server license.
Q: Does the data for the report have to come from a SQL Server database?
A: No. Data can come from any source. It is the host application's responsibility to collect data from whatever source it needs to come from, and supply it to the control in the form of ADO.NET DataTables or a collection of business objects. The ReportViewer control does not know or care where the data is coming from.
Q: Is the ReportViewer control part of the .NET Framework?
A: No. The ReportViewer control is distributed with Visual Studio 2005 and above, but it is not part of the .NET Framework.
Q: What editions of Visual Studio 2008 include ReportViewer?
A: ReportViewer is included in Standard and up. (i.e., all editions except Express.) An add-in is available for Visual Web Developer Express.
Q: What is the difference between RDL and RDLC formats?
A: RDL files are created by the SQL Server 2008 version of Report Designer. RDLC files are created by the Visual Studio 2008 version of Report Designer.
RDL and RDLC formats have the same XML schema. However, in RDLC files, some values (such as query text) are allowed to be empty, which means that they are not immediately ready to be published to a Report Server. The missing values can be entered by opening the RDLC file using the SQL Server 2008 version of Report Designer. (You have to rename .rdlc to .rdl first.)
RDL files are fully compatible with the ReportViewer control runtime. However, RDL files do not contain some information that the design-time of the ReportViewer control depends on for automatically generating data-binding code. By manually binding data, RDL files can be used in the ReportViewer control.
See also the RDL Viewer sample program.
Note that the ReportViewer control does not contain any logic for connecting to databases or executing queries. By separating out such logic, the ReportViewer has been made compatible with all data sources, including non-database data sources. However this means that when an RDL file is used by the ReportViewer control, the SQL related information in the RDL file is simply ignored by the control. It is the host application's responsibility to connect to databases, execute queries and supply data to the ReportViewer control in the form of ADO.NET DataTables.
Q: What does the C in RDLC stand for?
A: The C stands for Client-side processing. RDL stands for Report Definition Language.
Q: Why doesn't the ReportViewer control support parameter prompting in local mode?
A: The ReportViewer control does not prompt for parameters when in local mode. It prompts for parameters when it is connected to a Report Server.
In local mode it does not make sense for ReportViewer to prompt for parameters. The rationale is as follows: The most common use of report parameters is to pass to queries as values of query parameters. But unlike the Report Server, the ReportViewer control does not execute queries itself. Rather, queries are executed by the host application, and the result is passed to the ReportViewer control. So the ReportViewer control does not have the opportunity to set query parameters. Applications should take advantage of the parameterization features of Visual Studio data wizards instead.
Q: I installed Visual Studio 2008 and started Report Designer. I can't find the Preview tab. Where is the Preview tab that existed in SQL Server 2008 Report Designer?
A: There are two editions of Report Designer. One comes in the Visual Studio 2008 box. The other comes in the SQL Server 2008 box. If you are using the Report Designer included in SQL Server 2008, the Preview tab is still available. If you are using the Report Designer included in Visual Studio 2008, you have to run your application in order to preview the report.
Why is the Preview feature missing in the VS 2008 edition of Report Designer? Because the ReportViewer control does not contain any logic for connecting to databases or executing queries. Since it is your application's responsibility to supply data—and your application can supply data that originates anywhere, including objects that are internal to your application—data for previewing the report cannot be obtained without running your application.
Q: Why can't I just hand an RDL file to the report control and have it do everything and show me the report?
A: When the ReportViewer control is used in remote processing mode you can simply supply the url of the Report Server and the path to the report, and ReportViewer control will do the rest.
In local processing mode, the ReportViewer control is designed to integrate well with the host application. That includes being able to generate reports based on business objects that are internal to your application.
The ReportViewer control does not contain any logic for connecting to databases or executing queries. By separating out such logic, the ReportViewer has been made compatible with all kinds of data sources, including non-database data sources.
Rather than building in the logic to connect to databases and execute queries, ReportViewer is designed to integrate well with Visual Studio data wizards and the classes they generate, such as the TableAdapter class that knows how to connect to data sources, execute queries and fetch data.
See also the RDL Viewer sample program.
Q: I dragged and dropped a field from the Data Sources window into the report. When I run the application the report only shows one row of data. How can I display all rows?
A: To see all rows, first drag and drop a Table or a List to the report, then drag and drop the field into the Table or List.
Q: I am using the WebForms ReportViewer control. ReportViewer displays the message "Report is being generated" but the report is not displayed when this progress message goes away.
A: If you have set ReportViewer's height to a percentage, then in the .aspx file delete the line that sets doctype to xhtml. Why?
Q: Does xls export require Excel to be installed?
A: No. The xls export feature is independent of Excel. Excel is only required to view the xls file.
Q: Does PDF export require an Adobe license?
A: No. The ReportViewer control does not use any Adobe code to generate PDF files. PDF is an open format, and anyone can create PDF files without requiring a special license.
Q: What are the limitations of ReportViewer control?
A: Unlike the Report Server the ReportViewer control does not connect to databases or execute queries. Also, in local mode the only export formats available are Excel, Word and PDF. (In remote mode all formats supported by the Report Server are available.) The ReportViewer control cannot be extended by adding custom renderers or custom report items.
Besides additional export formats, the Report Server offers better scalability, central storage, management and access control of reports, caching, subscriptions, etc.