Share via


CrystalReportViewer Object Model

The CrystalReportViewer class has two roles:

  • In the Web or Windows Form, the CrystalReportViewer is exposed as a .NET control that can be added to the form to display a report. For specific information about its role as a .NET control, see Report Viewer Controls.
  • In the underlying code-behind the Web or Windows Form, the CrystalReportViewer class provides the simplest object model of the SDK. We explore that object model later in this section.

The simplest way to place a report into your Web or Windows Form is to add the CrystalReportViewer control to the form, and then, in the code-behind class, assign the path of the report as a string to the ReportSource property of the CrystalReportViewer class.

By assigning the report path directly to the control (rather than place the report within a more complex object model, such as ReportDocument or ReportClientDocument) you restrict your interface to only the simplest object model: the CrystalReportViewer.

Note

For more information on how to choose an object model, see Which Object Model Should I Use?.

CrystalReportViewer Object Model Diagram

These diagrams show the relationships within the CrystalReportViewer object model.

CrystalReportViewer has two object model diagrams, because the same control and class name (and therefore its underlying object model) is reused for both Windows and Web applications. Therefore, the CrystalReportViewer object model is repeated (with minor variations) in two different namespaces.

The Windows version of the CrystalReportViewer contains the major classes and events that are shared by both the Windows and Web versions of the object model.

Figure 1: CrystalDecisions.Windows.Forms.CrystalReportViewer Object Model

The Web version of the CrystalReportViewer object model contains the same classes and events as the Windows version, but in addition it has the following events that are related to how the ASPX page loads.

Figure 2: CrystalDecisions.Web.CrystalReportViewer Object Model

See Also