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

CrystalReportViewer Control in ASP.Net

Posted by  John Smith
on    December-03-2010 21:59 PM

ASP.Net ASP.Net 
Ratings:
0 Comment(s)
 8656  View(s)
Rate this:

CrystalReportViewer Control in ASP.Net

Crystal Reports is the standard reporting tool for Visual Studio .NET used to display data of presentation quality.

Steps to generate 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
















Recent Activities


Kamlakar Singh added new Blog Convert Text Document to PDF File   10 days ago

Kamlakar Singh added new Article Introduction to Backbone.js   10 days ago

Kamlakar Singh added new Question Explain the AdRotator Control.   10 days ago

Don't want to miss updates? Please click the below button!