Share via


Exploring the CrystalReportSource Control in Source View

In this section, you explore the tag-based application model that is used in ASP.NET version 2.0. This model makes it possible for you to set up a Web Site with Crystal Reports for Visual Studio, without having to write code. You also learn about the DataSource control framework and the CrystalReportSource control that are part of ASP.NET 2.0.

  1. Open the Default.aspx page.

  2. From the View menu, click Designer.

  3. At the bottom of the Web Form, click the Source button.

    The HTML for the Default.aspx page is displayed. This includes two related tags for Crystal Reports:

    • The CrystalReportSource tag, which nests the Report tag. The Report tag references the report in its FileName property.

      <CR:CrystalReportSource ID="CrystalReportSource1" Runat="server"
      EnableCaching="False" GroupPath="">
          <Report FileName="XtremeCustomers.rpt"></Report>
      </CR:CrystalReportSource>
      
    • The CrystalReportViewer tag, which references the CrystalReportSource by ID.

      <CR:CrystalReportViewer ID="CrystalReportViewer1" Runat="server"
      AutoDataBind="True"
          Height="1058px" CssFilename="CssFilename"
      ReportSourceID="CrystalReportSource1" Width="919px" />
      

The code demonstrates the new tag-based application model that is part of ASP.NET 2.0. Similar to ASP.NET version 1.0, the CrystalReportViewer control is represented by an XML tag. However, the available properties for this control have been increased in ASP.NET 2.0, to support the tag-based application development model.

In ASP.NET 2.0, data connectivity has been encapsulated within the DataSource control. The CrystalReportSource control adapts the DataSource control framework, except that it encapsulates report connectivity, rather than data connectivity. This framework is handled by the ReportSourceID property, in the main visual control.

For more information about additional properties of the CrystalReportSource control, see CrystalReportSource Control. The properties are also demonstrated in other reduced-code tutorials later in this section.