Tutorial: Displaying Report Parts with the CrystalReportPartsViewer Control

Introduction

In this tutorial, you learn how to break a report into parts and display each part by clicking through a series of successive hyperlinks. The hyperlinks move from a general report summary group to increasingly detailed report information. You set the general starting point, and then each successive hyperlink for the report. To display the report as parts, you assign the report to an alternate control named the CrystalReportPartsViewer control.

Note

Report parts are used only in Web Sites; they are not available for Windows projects.

There are two primary ways to view a report:

  • You can view the report as a whole.
  • You can view the report as a linked series of report parts.

Viewing the report as a whole

Reports are typically displayed as a single document (of one or more pages in length) in which detailed information is shown grouped by categories, subcategories and finally individual rows of detail.

For example, the Xtreme Access database that ships with Crystal Reports contains customer data about bicycle shops from many locations in the world. A typical way to view data in a report is to see the individual bicycle shops that are organized into groups based on regions, and then cities, with individual rows of information for each bicycle shop shown at the detail level.

The CrystalReportViewer control is used to display reports as a whole.

Viewing the report as a linked series of parts

With the introduction of web portals and cell phone web browsing, both of which provide a very limited viewing area for looking at information, a new way of displaying reports has been developed.

To achieve this, the all-in-one report that consisted of group categories, subcategories, and detail rows is redefined as a series of report parts. These parts are then displayed across a series of linked page views. In this scenario, the highest category group of information is displayed first. When an item from that top-level group is selected, a subcategory of group information is displayed. This drill down continues until the individual rows of detail for a particular subcategory are reached.

For example, the Customer data on bicycle shops in the Xtreme Access database is viewed initially as a list of regions. When one region is selected, the cities within that region are displayed. When a particular city is selected, the detail rows of bicycle shops within that particular city are displayed.

This breaking of a report into parts allows a large and complex report to be effectively accessed within a very limited viewing area.

The CrystalReportPartsViewer control is used to display reports as a series of linked parts.

Sample Code

This tutorial comes with Visual Basic and C# sample code that show the completed version of the project. Follow the instructions in this tutorial to create a new project, or open the sample code project to work from a completed version.

The sample code is stored in folders that are categorized by language and project type. The folder names for each sample code version are as follows:

  • C# Web Site: CS_Web_RDObjMod_ReportParts
  • Visual Basic Web Site: VB_Web_RDObjMod_ReportParts

To locate the folders that contain these samples, see Tutorials' Sample Code Directory.

In this section: