An equivalent viewer to the Windows Forms Viewer exists for ASP.NET-based applications; its called the Web Forms Viewer. This is an ASP.NET control derived from the WebControl class. This means that it is a server-side control that renders only HTML to the client browser. No special controls, applets, or files are required on the client in order to view reports with the Web Forms Viewer.
Like the Windows Forms Viewer, the Web Forms Viewer can be found in the Visual Studio .NET toolbox and is called CrystalReportViewer. It is found in the CrystalDecisions.Web namespace and the CrystalDecisions.Web.dll assembly. Many objects used in the Web Forms Viewer are contained in the CrystalDecisions.Shared namespace. The Web Forms Viewer has many properties and methods that control how it displays reports. This section covers these.
The first step to using the viewer is to drop it onto a Web Form from the toolbox. From there, properties can be set via the property browser or via the code-behind for the ASPX page. The first relevant property for the Web Forms Viewer is the ReportSource property. The nice thing is that the types of objects that can be passed into the ReportSource property are exactly the same as the types of objects that can be passed into the Windows Forms Viewers ReportSource property. For more information on the ReportSource property, refer to "The ReportSource Property" section earlier in this chapter on this topic.
After the ReportSource property is set, you can run the application. When the page is processed, the viewer is created; it processes the report specified in the report source, and then renders the output of the report page to HTML, which gets written to the response stream for the page. Figure 29.5 shows what the Web Forms Viewer looks like in action when rendering a report.
The next section describes some of the common properties used to customize the appearance and behavior of the report viewer.
The first level of customization is to show or hide the main components of the report viewer. The DisplayGroupTree and DisplayToolbar properties show and hide the group tree and toolbar, respectively. PageToTreeRatio is a handy property that enables you to set the width of the group tree as a ratio to the width of the rest of the page. The default value is 6. To show or hide individual toolbar buttons, there is a collection of properties beginning with Has such as HasExportButton and HasRefreshButton. Using these properties, you can control each button or button group on the toolbar to meet your needs. In addition, the toolbar buttons themselves are standard gif files contained in the following directory:
C:Program FilesCommon FilesCrystal Decisions2.5crystalreportviewers10images oolbar
These gif files can be changed using any graphics editing program or even replaced by entirely new images assuming the filenames are kept the same. Finally, there is a style sheet associated with the Web Forms Viewer that can be overridden to change the viewers colors, fonts, alignment, borders, and more. By default, the viewer looks for the css file in the following location:
/crystalreportviewers10/css/default.css
This location translates to the following physical path:
C:Program FilesCommon FilesCrystal Decisions2.5crystalreportviewers10cssdefault.css
You can either modify this default.css file or create multiple copies of the css files, effectively having several "skins" for the viewer, and dynamically point the viewer to one of the css files based on a user preference. The css file location is set via the CssFilename property of the Web Forms Viewer.
By default, the viewer renders one page of the report at a time, just like the report designer would do. However, sometimes users find that it would be easier to have all the reports content contained on a single Web page. You can do this by setting the SeparatePages property to false instead of its default value of true. When this is done, the viewer renders each page under one another, effectively producing a single Web page with the entire reports data.
Part I. Crystal Reports Design
Creating and Designing Basic Reports
Selecting and Grouping Data
Filtering, Sorting, and Summarizing Data
Understanding and Implementing Formulas
Implementing Parameters for Dynamic Reporting
Part II. Formatting Crystal Reports
Fundamentals of Report Formatting
Working with Report Sections
Visualizing Your Data with Charts and Maps
Custom Formatting Techniques
Part III. Advanced Crystal Reports Design
Using Cross-Tabs for Summarized Reporting
Using Record Selections and Alerts for Interactive Reporting
Using Subreports and Multi-Pass Reporting
Using Formulas and Custom Functions
Designing Effective Report Templates
Additional Data Sources for Crystal Reports
Multidimensional Reporting Against OLAP Data with Crystal Reports
Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design
Introduction to Crystal Repository
Crystal Reports Semantic Layer Business Views
Creating Crystal Analysis Reports
Advanced Crystal Analysis Report Design
Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting
Part V. Web Report Distribution Using Crystal Enterprise
Introduction to Crystal Enterprise
Using Crystal Enterprise with Web Desktop
Crystal Enterprise Architecture
Planning Considerations When Deploying Crystal Enterprise
Deploying Crystal Enterprise in a Complex Network Environment
Administering and Configuring Crystal Enterprise
Part VI. Customized Report Distribution Using Crystal Reports Components
Java Reporting Components
Crystal Reports .NET Components
COM Reporting Components
Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition
Introduction to Crystal Enterprise Embedded Edition
Crystal Enterprise Viewing Reports
Crystal Enterprise Embedded Report Modification and Creation
Part VIII. Customized Report Distribution Using Crystal Enterprise Professional
Introduction to the Crystal Enterprise Professional Object Model
Creating Enterprise Reports Applications with Crystal Enterprise Part I
Creating Enterprise Reporting Applications with Crystal Enterprise Part II
Appendix A. Using Sql Queries In Crystal Reports
Creating Enterprise Reporting Applications with Crystal Enterprise Part II