C# – ASP.NET – Crystal Report Viewer Print Button Not Working In ASP.NET

asp.netccrystal-reports

I am using visual studio 2008 and i am having issue with crystal reports.
When i clicks on print button it takes me to the popup with no page found. Popup url is

http://localhost/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer4/html/crystalexportdialog.htm

I have checked that crystalexportdialog.htm file exists on this path: C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles\CrystalReportWebFormViewer4\html\crystalexportdialog.htm

This is my code on page_load event.

    ReportDocument rptDoc = new ReportDocument();

    ReportProjectProperties ds = new ReportProjectProperties();// .xsd file name
    DataTable dt = DbUtility.GetProjectWorksheets(15);
    ds.Tables[0].Merge(dt);
    // Your .rpt file path will be below
    rptDoc.Load(Server.MapPath("../Reports/report1.rpt"));
    //set dataset to the report viewer.
    rptDoc.SetDataSource(ds);
    CrystalReportViewer1.ReportSource = rptDoc;

Thanks.

Best Answer

I have solved this issue. you can also see my same comments on this Crystal Report Viewer print/export buttons not working in ASP.NET MVC app

Crystal Report uses javascript files to print and its own images that should be included on root directory of the website. I have solved this issue by creating folers on root directory of my website

aspnet_client/system_web/2_0_50727/

and copied the folder CrystalReportWebFormViewer4 from this path

C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles\CrystalReportWebFormViewer4

in 2_0_50727 folder i have created. Now print images and print/export buttons are displayed and also print and export functionality is working fine.

Thanks.

Related Topic