[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Expand]Use Report Controls
  [Collapse]Shape Report Data
   [Expand]Filter Data
   [Expand]Group and Sort
   [Expand]Shape Data (Expression Bindings)
   [Collapse]Shaping Data (Legacy Data Bindings)
     Format Data
     Conditionally Change a Control's Appearance
     Conditionally Change a Label's Text
     Conditionally Filter Report Data
     Conditionally Suppress Controls
     Limit the Number of Records per Page
     Limit the Number of Records per Group
     Conditionally Change a Band's Visibility
     Calculate a Summary
     Calculate a Running Summary
     Calculate a Weighted Average
     Calculate a Custom Summary
     Simulate the Mail Merge Feature for Summary Fields
     Display Row Numbers in a Report, Group or Page
     Count the Number of Records in a Report or Group
     Count the Number of Groups in a Report
   [Expand]Use Calculated Fields
   [Expand]Use Report Parameters
   Arrange Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Expand]Provide Interactivity
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Conditionally Suppress Controls

This tutorial demonstrates how to conditionally suppress report controls.


This approach to conditionally suppressing controls applies when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Bindings.

See Conditionally Suppress Controls to learn about the alternative approach to solving this task.

See Data Binding Modes to learn more about the available binding modes.

The report created in this tutorial displays check boxes only for data fields whose value is true:

Do the following to conditionally suppress controls in a report:

  1. To create a table report in this tutorial, start with a report that is bound to the "Products" table of the sample Northwind database (the nwind.mdb file is included with the XtraReports installation). To learn more about binding a report to a data source, see Provide Data to Reports.
  2. Drag the ProductName field from the Field List window, and drop it on the report's Detail band.

    To create a check box, drag the Discontinued field with the right mouse button, drop it on the Detail band, and in the invoked menu, select CheckBox.

  3. Select the created xrCheckBox1 control and click its smart tag. In the invoked actions list, click the ellipsis button for the XRControl.FormattingRules property.

    Then, in the invoked Formatting Rules Editor, click the Edit Rule Sheet... button.

  4. In the invoked Formatting Rule Sheet Editor, click to create a new formatting rule. For this rule, set the Visible property to false.

    Then, locate the FormattingRule.Condition property and click its ellipsis button. The Condition Editor will appear.

  5. In this editor, define a Boolean expression for the rule (e.g., [Discontinued] == False). This means that the Discontinued data field should be false for the appropriate control to be hidden.

    Click OK to save the changes and close the dialog. Then, click Close to quit the Formatting Rule Sheet Editor.

  6. Now, in the Formatting Rules Editor, you can see the created rule (named formattingRule1), which should be moved to the list of active rules at the right using the arrow buttons in the middle of the dialog.

    It is also possible to customize the precedence of formatting rules by using the up and down arrow buttons at the right of the dialog. So, the rules are applied in the same order they are on the list, and the last rule on the list has the highest priority.

Is this topic helpful?​​​​​​​