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 you 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

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

Document Maps

The ReportViewer toolbar includes an icon used to toggle a document map on a report. A document map is a navigation area that is attached to the left side of the report view area. It contains a list of links that users can click to navigate to a specific area of the report. Not all reports have a document map; you must define one in the report definition if you want to use this feature. For more information about document maps and other interactive report features, see Adding Interactivity, Visibility, and Navigation to a Report (Visual Studio Report Designer).

Navigating a Report

The ReportViewer toolbar includes a variety of page navigation functions. You 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).

When navigating multi-page HTML reports, you can use the browser Back button. Alternatively, if you are not using the browser toolbar in your application, you can use the Back button on the ReportViewer toolbar instead. Note that the default state for the ReportViewer toolbar Back button is disabled. If you want to use this button, enable the ShowBackButton property on the ReportViewer control.

To navigate drillthrough reports, you can use the Back to Parent Report command on the ReportViewer toolbar, the browser Back button, or the ReportViewer toolbar Back button. When viewing drillthrough reports in the ReportViewer Web server control, you should always use one kind of Back button. If you use a combination of Back buttons in the same report session, you can get into a situation where you are attempting to navigate to a drillthrough report that is no longer in session. If this occurs, you will get an error message. Using the Back to Parent Report command prevents this error condition from occurring.

Stopping and Refreshing a Report

You can use the Refresh and Stop buttons to trigger or stop report rendering. If you click Refresh for a server report that is processed remotely, the report server re-processes the report with the most recent data. Note that report execution options that are configured on the report determine whether data is actually refreshed or retrieved from cache. The control does not check server report properties, so you must find out from the report server administrator whether the report is configured to use live data.

Refresh behavior differs for local processing mode. Because locally processed reports use data that is provided by your application, it is assumed that application code is handling refresh operations. To use the Refresh button on the toolbar, you must provide code that handles the Refresh event. If you do not handle this event, clicking Refresh has no effect. For more information about the Refresh event for the Web server control, see Refresh. For more information about the Windows Forms control version, see Refresh.

Printing a Report

The ReportViewer toolbar provides print support. Print support is implemented differently for each version of the control and the processing mode you use. Although you cannot customize or configure print functionality, you must enable print support on the report server for server reports that run in the ReportViewer Web server control. 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.

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 or section that is currently selected. 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 exposed through search operations. To search for subsequent occurrences of the same value, click Next.

Exporting a Report

The ReportViewer toolbar provides export formats so that you can save a report as an Excel or PDF application file. 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 might include extra pages or white space that you did not expect.

See Also

Community Additions