开发者

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

开发者 https://www.devze.com 2022-12-13 19:10 出处:网络
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开发者_如何

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开发者_如何学Python supported by this action'. I am using VS 2008 and MVC. This happens in my dev environment. Any ideas?


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.


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"];
}


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号