Adding Interactivity, Visibility, and Navigation to a Report (Visual Studio Report Designer)
If you are using the ReportViewer Web server control, you can create reports that include interactive features. Interactive features include end-user sort, links, bookmarks, document maps, and toggle items that you add to show or hide parts of a report. Interactive features are used in HTML reports. Document maps and toggling parts of the report are script-based features that work only if the browser is configured to run script. For more information about browser support, see Browser Support for ReportViewer Web Server Controls. For more information about interactive sorting, see Sorting Data in a Report (Visual Studio Report Designer).
Links
There are several types of links that you can add to a report. When you add a link to a text box, image, or chart element, you can specify one of three types of links:
Item | Description |
---|---|
URL |
A URL provides a link to a Web page, typically outside the report server. A hyperlink can be a static URL or an expression that evaluates to a URL. If you have a field in a database that contains URLs, the expression can contain that field, resulting in a dynamic list of hyperlinks in the report. You can add hyperlinks only to text boxes and images. To create a hyperlink, right-click the text box or image to which you want to add a link and then click Properties. On the Navigation tab, select Jump to URL. Type or select a URL or an expression that evaluates to a URL. |
Bookmark |
A bookmark link provides a link to a bookmark, or anchor, within the current report. To create a bookmark, set a bookmark on the destination report item and add bookmark links on report items that users should click, such as a word or button, to jump to the bookmarked report item. You can set bookmarks on any report item, but you can add bookmark links only to text boxes and images. For more information, see How to: Create a Bookmark (Visual Studio Report Designer). |
Drillthrough |
A drillthrough report link provides a link to another report on the report server, and can pass parameter values to that report. Drillthrough reports commonly contain details about an item that is contained in an original summary report. For example, you might have a sales summary report with a list of orders and sales totals. When a user clicks an order number in the summary list, another report opens that contains details about the order. For more information about drillthrough reports, see Configuring Subreports and Drillthrough Reports (Visual Studio Report Designer). |
Hiding Items
Each item in a report has a set of properties that determine whether the item is visible or hidden. You can use these properties to hide items on a report, conditionally hide data based on other data in the report, and provide an item that the user clicks to toggle items between visible and hidden. For example, you can create a drilldown report that shows summary data when the report is first loaded and shows detail rows when users click a particular text box.
The primary use of hidden items is to provide a report that shows summary data with the ability to drill down into detail data. To create this drilldown effect, select the group, column, or row to hide, set its hidden state to True, and then set the toggle item to the name of a text box in a containing group. At run time, the user can click the text box to expand and collapse the detail data. For more information, see How to: Hide or Define Toggle Visibility on a Report Item (Visual Studio Report Designer).
Note
When you create a drilldown report, the visibility information must be set on the group, column, or row that you want to hide, not a single text box in the row or column. If you set these options on just the text box, the rows or columns will not collapse.
Document Map
Another way a user can interact with a report is through a document map. In the ReportViewer control, a document map appears as a table of contents next to the report. Report sections and groups are arranged in a hierarchy of links. Clicking items in the document map refreshes the report and displays the area of the report that corresponds to the item in the document map.
The document map is intended for use in HTML reports. Other export formats have different ways of articulating a document map:
PDF shows a document map as the Bookmarks pane. All items in the document map are listed one after the other down the pane. There is no hierarchy to the list of links.
Excel shows a document map as a named worksheet that includes a hierarchy of links. Report sections are rendered in separate worksheets that are included with the document map in the same workbook.
To create a document map, add document map labels to those report items that should appear in the map, such as group headings and charts. If any report items have a label, a document map is automatically generated when a user views the report. How to: Create a Document Map (Visual Studio Report Designer).
See Also
Tasks
How to: Filter Data in a Report (Visual Studio Report Designer)
Concepts
Adding Data Regions to a Report (Visual Studio Report Designer)
Defining a Report Layout (Visual Studio Report Designer)