Crystal Reports and ASP.NET 2.0 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Crystal Reports and ASP.NET 2.0

Description:

In Visual Studio 2005, when you add a .NET control to a Web Form, a Smart Tag panel appears. ... binding to a file directory path through the Properties window. ... – PowerPoint PPT presentation

Number of Views:662
Avg rating:3.0/5.0
Slides: 12
Provided by: charlie63
Category:
Tags: asp | net | crystal | reports

less

Transcript and Presenter's Notes

Title: Crystal Reports and ASP.NET 2.0


1
Crystal Reports and ASP.NET 2.0
  • Building a Web Reports Interface

2
Crystal Reports Web Interface
  • What is a Reports Interface?A set of ASP.NET Web
    pages designed to organize and present an
    unlimited collection of Crystal Reports.
    Information about each report is stored in SQL
    2000 reportid, reporttitle, reportfile,
    reportcategory.
  • Features
  • Reports listed in simple grid-like format
  • Users can pick reports based on multiple
    categories
  • Single driver page used to launch reports in
    CrystalReportsViewer
  • Advantages
  • Easy to deploy reports throughout the
    organization -reports become immediately
    available once copied to repository
  • Ease of maintenance (database driven)
    -reports and categories can be added, deleted,
    renamed -no special coding.
  • Cost-effective
  • No special software browser-based
  • Uses standard Microsoft tools (VS2005

3
New Features in ASP.NET 2.0
Crystal Reports project templates (ASP.NET
Crystal Reports Website) Visual Studio 2005 has
Crystal Report project templates for Visual
Basic, C, and J Web Sites. The project
templates create a default Crystal Reports
project and start the New Report Creation Wizard
to help new users create reports. Smart TagsIn
Visual Studio 2005, when you add a .NET control
to a Web Form, a Smart Tag panel appears. The
CrystalReportViewer Smart Tag panel lets you
create, open, or edit a Crystal report from a Web
or Windows form.
ReportSource and DataSource controls The
ReportSource control contains a report that
encapsulates the data, whereas a DataSource
control (such as SqlDataSource) contains the data
itself. The ReportSource control is also part of
the simplified tag-based application development
model provided with ASP.NET version 2.0.
Automatic data binding With automatic data
binding, you no longer need to call the
DataBind() method in the code-behind class when
binding to a file directory path through the
Properties window.
4
Report Interface Components
Reports driver Middle Tier - A single .NET
page that can launch any known report on demand.
Presentation Layer Allows users to select from a
list of available crystal reports based on
multiple categories.
reportDriver.aspx
reportMenu.aspx
Reports Layer - Repository of available reports
Financial Statement.rpt
Sales by Category.rpt
Employee Sales.rpt
DATA ACCESS LAYER (DAL) - Database tables used
for application queries and report selection
5
Reports Database Table
6
Report Selection
7
Launch Report in CrystalViewer
8
Source Code (reportMenu.aspx)
  • ltdivgt
  • ltbr /gtReport Categoryltbr /gt
  • ltaspDropDownList ID"DropDownList1"
    runat"server" AutoPostBack"True"
    DataSourceID"SqlDataSource2" DataTextField"repor
    tCategory" DataValueField"reportCategory"gt
  • lt/aspDropDownListgt
  • ltbr /gt
  • ltbr /gt
  • ltaspDataList ID"DataList1"
    runat"server" CellPadding"4" DataKeyField"Repor
    tID"
  • DataSourceID"SqlDataSource1"
    ForeColor"333333"gt
  • ltItemTemplategt
  • lta href"reportDriver.aspx?reporti
    dlt Eval("ReportID") gt" target"_blank"gtlt
    Eval("ReportTitle") gtlt/agt
  • lt/ItemTemplategt
  • lt/aspDataListgt
  • ltaspSqlDataSource ID"SqlDataSource1"
    runat"server" ConnectionString"lt
    ConnectionStringsCRInterfaceConnectionString gt"
  • SelectCommand"SELECT FROM
    Reports WHERE (ReportCategory
    _at_ReportCategory)"gt
  • ltSelectParametersgt
  • ltaspControlParameter
    ControlID"DropDownList1" DefaultValue"Feature
    Examples" Name"ReportCategory"

9
Source Code (reportDriver.aspx)
  • lt_at_ Page Language"VB" AutoEventWireup"false"
    CodeFile"reportDriver.aspx.vb"
    Inherits"ReportDriver" gt
  • lt_at_ Register TagPrefix"CR" Namespace"CrystalDeci
    sions.Web" Assembly"CrystalDecisions.Web,
    Version10.2.3600.0, Cultureneutral,
    PublicKeyToken692fbea5521e1304" gt
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http//www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"gt
  • lthtml xmlns"http//www.w3.org/1999/xhtml" gt
  • lthead runat"server"gt
  • lttitlegtCrystal Reports Interface
    Examplelt/titlegt
  • lt/headgt
  • ltbodygt
  • ltform id"form1" runat"server"gt
  • ltdivgt
  • ltCRCrystalReportViewer
    ID"CrystalReportViewer1" Runat"server"
    AutoDataBind"True"
  • Height"947px" ReportSourceID"Crystal
    ReportSource1" Width"845px" /gt
  • ltCRCrystalReportSource
    ID"CrystalReportSource1" runat"server"
    Report-FileName"CrystalReport1.rpt"gtlt/CRCrysta
    lReportSourcegt
  • ltaspSqlDataSource ID"SqlDataSource1"
    runat"server" ConnectionString"lt
    ConnectionStringsCRInterfaceConnectionString gt"

10
VB Class (reportDriver.aspx.vb)
  • Partial Class ReportDriver
  • Inherits System.Web.UI.Page
  • Protected Sub Page_Load(ByVal sender As
    Object, ByVal e As System.EventArgs) Handles
    Me.Load
  • Me.CrystalReportSource1.Report.FileName
    getReportFileName()
  • End Sub
  • Private Function getReportFileName()
  • Dim dv As System.Data.DataView
    SqlDataSource1.Select(DataSourceSelectArguments.Em
    pty)
  • Return "reports/" dv.Table.Rows(0)("Repo
    rtCategory") "/" dv.Table.Rows(0)("ReportFile"
    )
  • End Function
  • End Class

11
Resources
  • My Contact Info
  • Charlie Parker
  • PARKER Design Group, Inc.
  • 1101 Pennsylvania Avenue, NW
  • Suite 600
  • Washington, DC 20004
  • (202) 756-4980
  • charlie_at_homeshowcase.net
Write a Comment
User Comments (0)
About PowerShow.com