Megosztás a következőn keresztül:


How to: Add a Visibility Toggle to an Item (Reporting Services)

Add a visibility toggle when you want to enable a user to interactively show or hide report items or, for a table or matrix, rows and columns associated with a group. To toggle the visibility for an item, you set the visibility properties for the item that you want to show or hide. You must specify the name of the text box in the report where you want to display the toggle image. In the rendered report, the text box displays a plus (+) or minus (-) in addition to its contents. When the user clicks the toggle, the report display is refreshed to show the current visibility settings for items in the reprot.

Typically, visibility toggles are used to initially display summary data and to provide the user with the option of seeing more details. For example, you can initially hide a table that displays values for a chart, or hide child groups for a table with nested row or column groups, as in a drilldown report.

To toggle the visibility of a report item

  1. In Design view, right-click the report item to show or hide, and then click <report item> Properties. The <report item> Properties dialog box for the report item opens.

  2. Click Visibility.

  3. In When the report is initially run, choose one of the following options to set the visibility of this report item the first time you run a report:

    • Select Show to display the report item.

    • Select Hide to hide the report item.

    • Select Show or hide based on an expression to use an expression evaluated at run time to determine the visibility. Click (fx) to open the Expression dialog box to create an expression.

      Note

      When you specify an expression for visibility, you are setting the Hidden property of the report item. The evaluated expression shows the report item when the value is False, and hides the report item when the value is True.

  4. In Display can be toggled by this report item, from the drop-down box, select the name of a text box to which to add the toggle image.

    Note

    The text box must be in the same container hierarchy or higher (up to and including the report body).

  5. To test the toggle, run the report and click the text box with the toggle image. The report display refreshes to show report items with their toggled visibility.

To toggle the visibility of a table, matrix, or list group

  1. In Design view, click the table or matrix to select it. The Grouping pane displays the row and column groups.

  2. Right-click anywhere in the title bar of the Grouping pane, and then click Advanced. The Grouping pane mode toggles to show the underlying display structure for rows and columns on the design surface.

  3. In the appropriate group pane, click the name of the row group or column group for which you want to hide the associated rows or columns. The group is selected and the Properties pane shows the Tablix Member properties.

    Note

    If you do not see the Properties pane, from the View menu, click Properties Window.

  4. In Hidden, choose one of the following options to set the visibility of this report item the first time you run a report:

    • Select True to display the report item.

    • Select False to hide the report item.

    • Select <Expression> to open the Expression dialog box to create an expression that is evaluated at run time to determine the visibility.

  5. In ToggleItem, from the drop-down box, select the name of a text box to which to add the toggle image.

    Note

    The name of the text box must either be in the same group as the item that is being hidden or in an ancestor group.

  6. To test the toggle, run the report and click the text box with the toggle image. The report display refreshes to show row groups and column groups with their toggled visibility.