articles

Home / DeveloperSection / Articles / CrystalReportViewer Control in ASP.Net

CrystalReportViewer Control in ASP.Net

CrystalReportViewer Control in ASP.Net

John Smith 23667 03-Dec-2010

Where A Crystal Reports is the standard reporting tool for Visual Studio .NET. It's used to display data of presentation quality.

Steps to generate a report using CrystalReportViewer

Drag and drop CrystalReportViewer

CrystalReportViewer Control in ASP.Net

Add DataSet

CrystalReportViewer Control in ASP.Net

 

Click add

CrystalReportViewer Control in ASP.Net

Click on server explorer

Drag and Drop table

CrystalReportViewer Control in ASP.Net

 

Now add CrystalReport

CrystalReportViewer Control in ASP.Net

Click add

CrystalReportViewer Control in ASP.Net

Click  Ok

CrystalReportViewer Control in ASP.Net

Expand create ProjectData

CrystalReportViewer Control in ASP.Net

Expand AD.NET Datasets and select table and then click next

CrystalReportViewer Control in ASP.Net

Click highlighted array to select field and click next

CrystalReportViewer Control in ASP.Net

Click next

CrystalReportViewer Control in ASP.Net

Click next

 

 

CrystalReportViewer Control in ASP.Net

Click finish

protected void Page_Load(object sender, EventArgs e)
{
//To instantiate a ReportBuilder, you must provide the ReportDocument to be built.
ReportDocument ReportDocument1 = new ReportDocument();
//Loading Crystal Report to Report Object
reportDocumentObj.Load(Server.MapPath("~/CrystalReport.rpt"));
//Creating instance of Data Table created earlier.
DataSet1.regformDataTable dt = new DataSet1.regformDataTable();
DataSet1TableAdapters.regformTableAdapter da = new DataSet1TableAdapters.regformTableAdapter();
//Filling data table
da.Fill(dt);
//Setting Data Source of Report Document.
ReportDocument1.SetDataSource((DataTable)dt);
//Assigning object of ReportDocument to Crystal Report as ReportSource
CrystalReportViewer1.ReportSource = ReportDocument1; 
}
// Use namespace CrystalDecisions.CrystalReports.Engine;

Now Report is generated.

CrystalReportViewer Control in ASP.Net


Read also this Article - Using ReportViewer in WinForms C#


Updated 04-Mar-2020
I am best.

Leave Comment

Comments

Liked By