Learn to create simple reports using Crystal Reports for .NET
Learn to display reports in the context of ASP.NET
Filter rows within reports
At some point, you'll need to display data, gathered from some data source, in the context of an ASP.NET page. You might consider writing code to create the report yourself, but you'd soon realize that it's quite tricky to create your own report writer.
Luckily, you don't have to do all the work yourself. Visual Studio .NET provides Crystal Reports for .NET, and this tool can make it easy for you to design and display professional-looking reports from within your ASP.NET applications. In addition to the standard report-designing tools, Crystal Reports also provides some nice tools that allow you to group data in a hierarchical manner and to drill down to a specific grouping at runtime. In this chapter, you'll create a simple report and see how to display the output on an ASP.NET page.
The Crystal Reports designer is a banded report designer, meaning that there are nested bands where you create the various elements of your report. Much like the DataList and Repeater controls, where you supply content using various templates whose contents are rendered by the page framework as it displays the page, a banded report designer allows you to lay out report header and footer content, page header and footer content, and detail row content, all in separate areas of the designer.
Once you create your report, you can save it as a report template. Then, when you need the report, the Crystal Reports runtime engine can use the template you've created, fill it with the data that's currently available, and display the report. That is, you're not creating a finished report just a template that can be "filled" with data as necessary.
The intent of this chapter is not to teach you everything about Crystal Reports that could be the subject for a whole book. This chapter shows you how to create a very simple report and then how to display that report on a Web page. Because you'll almost always need to filter data, the chapter also shows how to restrict the amount of rows returned from a report by setting a property on the CrystalReportViewer control.