Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can i use crystal report in asp.net mvc3
Posted

 
Share this answer
 
Yes you can try following

C#
using CrystalDecisions.CrystalReports.Engine;

public ActionResult Report()
{
    ReportClass rptH = new ReportClass();
    rptH.FileName = Server.MapPath("[reportName].rpt");
    rptH.Load();
    rptH.SetDataSource([datatable]);
    Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
    return File(stream, "application/pdf");   
}



However, according to experts crystal reports does not work well with MVC so you can also try following alternate

* Create a seperate directory for reports
* Create normal ASPX pages for reports


HTH
 
Share this answer
 
Comments
K2@ketu 1-Feb-13 5:13am    
Can u plz provide code of ReportClass.cs??????
Of course, look at this one man

ASP.NET MVC and Crystal Reports[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900