Freigeben über


How to: Apply Conditional Visibility Controls

Some reports have data that is printed conditionally. For example, if the request page for the report has a Show Address Details check box, then the address details are printed only if the check box is selected. Another example is a report that could show data based on a value such as a balance. If the balance is 0, then the report does not show the balance. To specify conditional visibility in an RDLC report layout, use an expression on the Visibility property of the report item or table row.

To specify conditional visibility controls

  1. In the development environment, on the Tools menu, choose Object Designer.

  2. In Object Designer, choose Report, select the report that you want to modify, and then choose Design.

  3. On the View menu, choose Layout.

  4. In Visual Studio, in the Report.rdlc file, select the control or table row that you want to show conditionally.

  5. On the View menu, choose Properties Window.

  6. In the Properties window, expand Visibility.

  7. Under Visibility, in the Hidden field, select <Expression…> from the drop-down list.

  8. In the Expression window, enter the conditional statement for when the control or row is hidden, and then choose the OK button.

    The following illustration shows an example of a conditional visibility expression on report 116, Statement, in the CRONUS International Ltd. demonstration database.

    Conditional visibility

See Also

Designing Reports
How to: Conditionally Display Filter Headers