Configuring and Using the ReportViewer Toolbar

You can set properties in the Properties window or in code to configure the ReportViewer control and ReportViewer toolbar. You can remove or disable specific commands and set values that are used to initialize the toolbar. For more information about the ReportViewer Web server control properties, see Microsoft.Reporting.WebForms.ReportViewer Properties. For more information about the Windows Forms control properties, see Microsoft.Reporting.WinForms.ReportViewer Properties.

ReportViewer Toolbar

The ReportViewer control includes a toolbar that provides navigation, search, export, and print functionality so that users can work with reports in a deployed application. You can set properties on the toolbar at design time to control its appearance and determine the availability of run-time options. If you want a different toolbar implementation, you can create a custom toolbar to replace the default toolbar.

ReportViewer toolbar

Note

Due to differences in how user interface elements are rendered in HTML and Graphics Design Instrumentation (GDI) format, the report toolbar varies depending on whether you are using the Web server control or the Windows Forms control.

Document Maps

A document map is a navigation area that contains a list of links that users can click to navigate to a specific area of the report. The document map is a collapsible split box on the left side of the report view area (or on the right side in right-to-left environments). Not all reports have a document map; you must define one in the report definition if you want to display it in the report viewer. For more information about document maps and other interactive report features, see Adding Interactivity, Visibility, and Navigation to a Report (Visual Studio Report Designer).

The ReportViewer toolbar includes a variety of page navigation functions. The user can select a specific page or navigate directly to the first or last page. Pages are determined by pages breaks that are explicitly defined in the report definition. Page breaks can also be calculated automatically, depending on the report output format you are using. For more information, see Defining Page Size and Page Breaks in a Report (Visual Studio Report Designer).

Because the ASP.NET ReportViewer control uses asynchronous postbacks for interactivity by default, the user cannot use the browser Back button unless you set the InteractivityPostBackMode property to AlwaysSynchronous.

To navigate drillthrough reports, the user can use the Back to Parent Report button on the ReportViewer toolbar or the browser Back button if you set the InteractivityPostBackMode property accordingly. However, it is recommended that you design your application with one navigation option in mind in order to keep the session state consistent when the user navigates drillthrough reports. Otherwise, the user may receive a "Back call without drillthrough report" error message when navigating the drillthrough reports. To help keep the user to one navigation option, you can:

  • Use the AlwaysAsynchronous mode and set ShowBackButton to true.

  • Use the AlwaysSynchronous or SynchronousOnDrillthrough mode and set ShowBackButton to false. This limits the user to the browser Back button. Note that this option does not take advantage of the Web server control's AJAX features.

Stopping and Refreshing a Report

In the Web server control, the user can click the cancel link in the busy status indicator to cancel report rendering. In the Windows Forms control, the user can click the Stop button in the ReportViewer toolbar to cancel report rendering. The user can use the Refresh button to trigger report rendering.

If the user clicks Refresh for a server report, the report server re-processes the report with the most recent data. Note that the most recent data is subject to the caching and snapshot policies set on the report.

If the user clicks Refresh for a local report, the behavior can be different. Because locally processed reports use data that is provided by your application, you may need to update your data source during refresh operations by providing code that handles the ReportViewer.ReportRefresh event. If you do not handle this event for the Windows Forms control, clicking Refresh .will refresh the report with old data in your application. For more information about the ReportViewer.ReportRefresh event for the Web server control, see ReportRefresh. For more information about the Windows Forms control version, see ReportRefresh.

Printing a Report

The ReportViewer toolbar provides print support. Print support is implemented differently for each version of the ReportViewer control. Moreover, the Web server control only provides print support in Internet Explorer. For more information, see Printing Reports from ReportViewer.

Zooming the Report Page

The ReportViewer toolbar provides standard zoom functionality so that you can enlarge or shrink the report. The Web server control only provides zooming support in Internet Explorer.

Searching a Report

The ReportViewer toolbar includes a search field so that you can find specific text within a report. Search for content in the report by typing a word or phrase that you want to find. The search is case-insensitive and begins at the page that is currently displayed. Wildcards and Boolean search operators are not supported. Only visible content is included in a search operation. If the report uses show / hide functionality, hidden content is not searched. To search for subsequent occurrences of the same value, click Next.

Exporting a Report

The ReportViewer toolbar provides export formats so that the user can save a report in a supported format. A local report can be exported to an Excel, PDF, or Word file. A server report can be exported to any format the report server supports. If you are using the Web server control, you can set the ExportContentDisposition property on the control to immediately display the exported report in Excel or a PDF viewer instead of saving it as a file.

The same report can have a different appearance and functionality depending on the rendering format you select. Reports that have links, document maps, and bookmarks might not function properly once the report is saved to a file. Depending on how you align items in a report, the report layout in a different file format may include a different number of pages or extra white space. For more information, see Exporting Reports in SQL Server Books Online.

See Also

Concepts

Printing Reports from ReportViewer
ReportViewer Web Server and Windows Forms Controls
Configuring ReportViewer for Local Processing
Configuring ReportViewer for Remote Processing