[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamental Concepts
    [Expand]Print Preview
    [Expand]Using Bricks
    [Expand]Using Printing Links
    [Expand]Page Header and Footer
    [Expand]Printing DevExpress Controls
      How to: Create an Interactive Drill-Down Report
      How to: Create a Document Map (Bookmarks)
      How to: Calculate Page and Report Summaries
      How to: Add a Watermark to a Document
      How to: Save and Restore a Document's Watermark in Print Preview
      How to: Add Different Watermarks to Document Pages
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[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]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)

How to: Create an Interactive Drill-Down Report

This document explains the creation of a tree-like report structure, implemented in the XtraPrinting demo Master-Detail application.

This demo creates a report using a custom CreateReport procedure with whose data is obtained from the nwind.mdb database. The main report page contains data from the "Customers" table. The report is displayed in the custom MyPrintControl control derived from the PrintControl class. This control is placed onto the tab page of the tab control named PSTab. The application form also contains the standard Print Preview Menu and Toolbar, provided by the PrintBarManager component, which is linked to a MyPrintControl instance. The drill-down function is invoked by clicking the book icon, indicated by a changed mouse cursor. The report preview is demonstrated in the following image:

During report creation, icons for displaying row state (collapsed or expanded) in the master report are drawn using the BrickGraphics.DrawImage method of the BrickGraphics class. The Brick.ID value of these bricks is assigned to the "CustomerID" field value of the corresponding row, and the Brick.Value property value of these bricks contains a flag, determining record state: 0 - if the master row is collapsed, and 1 - if expanded. The MyPrintControl class provides a ChangeBrickClick event, which uses the PrintControl.BrickClick event to handle user clicks.

Clicking the closed book icon near the Customer ID column adds a new tab to the PSTab control, and changes the row state icon to an open book image and creates a new report within that tab. This report contains data from the "Orders" table.

That data is obtained from the rows where the "CustomerID" field value equals the Brick.ID property value of the clicked ImageBrick. If the row corresponding to the clicked icon has already been expanded, then clicking that icon removes the tab with a specific report and changes the icon to a closed book image.

These actions are performed in the ChangeClickBrick event handler. The code for this handler is shown below. For the complete application code refer to Master-Detail demo of XtraPrinting Library.

When the row state icon is clicked, a new tab with a report preview is created, as illustrated in the following picture:

You may use similar approach to create reports that provide the drill-down functionality.

Expanded See Also

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