ASP.NET(vb.net) & CrystalReportSource - Learn and example script how to use CrystalReportSource for ASP.NET Web Application. The CrystalReportSource control is part of the new tag-based application development model that is provided with ASP.NET version 2.0.
ShotDev Focus:
- ASP.NET(vb.net) & CrystalReportSource
Example
Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <div> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" Height="1106px" ReportSourceID="CReportSource1" Width="876px" /> <CR:CrystalReportSource ID="CReportSource1" runat="server"> <Report FileName="CReport1.rpt"> </Report> </CR:CrystalReportSource> </div> </form> </body> </html>
Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page End Class
(or Create Code in Source file) CrystalReport.aspx
<%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %> <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim CRSource As new CrystalReportSource() CRSource.Report.FileName = "CReport1.rpt" Me.CrystalReportViewer1.ReportSource = CRSource End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server" > <CR:CrystalReportViewer ID="CrystalReportViewer1" Width="500px" runat="server"/> </form> </body> </html>
Screenshot