Crystal Report Viewer print/export buttons not working in ASP.NET MVC app

帅比萌擦擦* 提交于 2019-12-18 09:33:30

问题


My MVC app uses the push model and the CR viewer for reporting. All works great in displaying the report in the viewer however the print/export buttons give the javascript error 'Object not supported by this action'. I am using VS 2008 and MVC. This happens in my dev environment. Any ideas?


回答1:


The answer to this is so stupid its embarrassing - my popup blocker was causing this error. I did get another error or on th the deployed site however and that was a 404 not found on 'aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer4/html/crystalexportdialog.htm'. I just created the folder and on the site and copied the contents of C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles\CrystalReportWebFormViewer4 to it and it fixed it.




回答2:


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.




回答3:


My problem was almost if not the same as yours. When I clicked export for print my report became clear. I updated my aspx page_load event to:

if (!isPostBack)
{
    Dataset allCompanies=datasetMethod(); ///Method Retaining a dataset
    ReportDocument oRpt=new ReportDocument();
    oRpt.SetDataSource(allCompanies);
    CrystalReportViewer1.ReportSource = oRpt;
    Session["Report"] = oRpt;
}
else
{
     CrystalReportViewer1.ReportSource = Session["Report"];
}



回答4:


I was also faced with the same problem when I deployed my Website on IIS. Crystal Report didn't show me the print, next, previous etc. buttons, I then just created a folder inside wwwroot folder.

The complete path is:

C:\inetpub\wwwroot\aspnet_client\System_Web\2_0_50727`

I copied CrystalReportWebFormViewer4 from

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

and pasted inside the 2_0_50727 folder.

Everything is now OK, but on the browser you have to allow the pop-up window to print your document.




回答5:


I got the same problem when i removed the Default Web Site from IIS and added a new Website with different location.

If you are doing so, then we need to copy the aspnet_client folder from location C:\inetpub\wwwroot to the location where the newly configured Web site is mapped.



来源:https://stackoverflow.com/questions/1898590/crystal-report-viewer-print-export-buttons-not-working-in-asp-net-mvc-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!