Share via


Binding to a CrystalReportSource Control (Web Sites in Visual Studio)

Object Model

This report binding scenario uses the CrystalReportViewer (see Report Binding with CrystalReportViewer Object Model.)

Location of Reports

Reports are stored in a file directory.

Description

This is an alternative version of the simplest report binding scenario, Binding to a File Directory Path in Code. In this scenario, you bind the report with the new reduced-code, tag-based application development model of ASP.NET version 2.0. For more information on the tag-based application development model, see Tag-based Application Development Model.

Note

This report binding scenario is available only for Web Sites.

In this scenario, you use Smart Tasks to create a CrystalReportSource control. Then you select a report for the CrystalReportSource control.

Rather than manually write code to interact with the report and enable its access to the CrystalReportViewer object model, you make selections from the Smart Task panel (in Design view) or you directly enter declarative XML (in Source view).

With declarative XML, you can associate the <Parameters> and <DataSources> tags, which are nested within the <Report> tag, to an assortment of non-visual controls that are available from the Parameter and DataSource frameworks.

Note

The Parameter and DataSource frameworks are new features of ASP.NET 2.0. They include controls such as: ControlParameter or QueryStringParameter and SqlDataSource or JetDataSource.

The tag-based application development model provides a quick and simple method to perform limited interaction with the report, without the need to write code.

Pros

  • Design time preview: the report can be previewed at design time, in the Web or Windows Form.
  • Easiest way to create report interaction: the simplified, reduced-code approach of the tag-based application development model can be used to interact with the report.
  • The same pros that are listed in Binding to a File Directory Path in Code.

Cons

  • Limited distribution: reports typically stay on the same machine as the application, due to the complications involved when permissions are granted to the ASPNET user account to access another machine on the network.
  • Limited object model: this binding scenario offers only the limited object model that is part of the CrystalReportViewer. See Which Object Model Should I Use?.

Implementation

To learn how to bind to a CrystalReportSource control in Visual Studio Web Sites, see Tutorial: Reduced-Code Web Site Setup with Crystal Reports Using Smart Tasks.