ActiveReports 9
Conditionally Show or Hide Details
Show AllShow All
Hide AllHide All

In a section layout, you can use conditions in the Format event to control the display of report's detail section at runtime.

These steps assume that you have already added a Section Report (code-based) template in a Visual Studio project and connected it to a data source. See Adding an ActiveReport to a Project and Bind Reports to a Data Source for further information.

Note: These steps use the Products table from the NWind database. By default, in ActiveReports, the NWind.mdb file is located in the [User Documents folder]\GrapeCity Samples\ActiveReports 9\Data\NWind.mdb.
  1. From the Report Explorer, drag and drop the following fields onto the detail section of the report and set their properties in the Properties Window.
    Field Name Properties
    ProductName Location: 0, 0.104 in
    Size: 2.667, 0.2 in
    Discontinued Location: 2.667, 0.104 in
    Size: 2.021, 0.2 in
    ReorderLevel Location: 4.688, 0.104 in
    Size: 1.812, 0.2 in
  2. Double-click the detail section of the report to create an event-handling method for the Format event.
  3. Add the following code to the handler to hide the details of a product which is discontinued.

    To write the code in Visual Basic.NET

    To write the code in C#

  4. In Form1 of the Visual Studio project, add a Viewer control and load the report you created above in it. See Using the Viewer for further details.
  5. Press F5 to debug and see a report with discontinued products hidden from view.
See Also

 

 


Copyright © 2016 GrapeCity, inc. All rights reserved

Support Forum