Back to Devexpress

Use Sub-bands to Show a Report Band Conditionally

xtrareports-119475-feature-guide-to-devexpress-reports-use-expressions-expressions-tasks-and-solutions-conditionally-change-a-bands-visibility.md

latest1.8 KB
Original Source

Use Sub-bands to Show a Report Band Conditionally

  • Feb 18, 2026

This topic describes how to use sub-bands to display different content based on a specific condition.

The report created in this tutorial contains two sub-bands of the DetailBand with different sets of report controls. One sub-band displays data when the customer’s Contact Title is `Owner’; another sub-band displays data for other cases.

Do the following to create a report with conditionally visible sub-bands:

  1. Use the Report Wizard to create a Table report bound to the Customers table of the Sample Northwind SQLite Database (nwind.db).

  2. Add two sub-bands to the Detail band:

  3. Copy the data-bound table to the sub-bands. Delete the cells bound to the Address, City, Region, and Country fields from SubBand2. Delete the data-bound table from the Detail band:

  4. Select SubBand1 and click the f button to invoke the Expression Editor. Specify the following expression for the Visible property:

  5. Select SubBand2 and click the f button to invoke the Expression Editor. Specify the following expression for the Visible property:

  6. Switch to the Preview window and observe the result: