If you have used Crystal Report (Crystal Reports 2008 Official Guide) with Microsoft ASP.NET, you might have face this issue many times. This is a common problem with Crystal Report deployment and many people don't have proper solution for the problem. Crystal Report Toolbar images not shown in deployed environment is one of the main inconvenient with the tool that is leaded many developers not to use Crystal Report tool as their reporting tool even though Microsoft Visual Studio distribute Business Objects Crystal Report Tools free of charge. Even though your report is perfectly working inside the report viewer, it is not useful if the report viewers toolbar is not working properly. You can not navigate through multiple pages, can not export your report, can not print the report...etc. So that it is equally important to work your report and report viewer both correctly to feel end user happy reporting experience.
I have found few ways to overcome this issue and first solution is install Crystal Report Components for .NET using your Visual Studio Installation CD/DVD set. This method is applicable most of the time Vista operating system and XP with newly patches. I have experienced even though the the installation goes well, still problem might persist due to some problems of locating the installed images. Here you need understand that if the installation went well the required images will copy into your hard drive, but some cases the report viewer is unable to locate them. If the problem is still persist you can go into next solution where install "crredist2005_x86.msi" from SAP website or Upgrade Crystal Reports 2008 Win Nul. Business Object's Crystal Report Viewer is distributed by SAP and they have provide installation for Crystal Report Views as well. In same way you can install this msi file and check whether your problem is solved. This will install "Crystal Reports for .NET Framework 2.0 (x86)" into the system and it is having all the necessary components to run your report in crystal report viewer.
Above two methods are not very specific and blindly hit the target. But try them first and most of the time you will get happy results. But still if you are getting same error you have another method. After install above components and still you have error means all necessary components have been installed properly but your report viewer is unable to locate the images. Then easies them is locate your image file location and register with your report viewer. How you can do this? This depends on the way you have programmed your report. You have basically two methods to program either you can define all the parameters when your create your report viewer.
Fig 1: CR:CrystalReportViewer code section
or if you drag and drop the report viewer control from toolbox of visual studio editor it will insert the report viewer component separately and it takes all the configuration details by including "default.css" style sheet from "C:\inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\css\default.css" in header section of the page.
Fig 2: "aspnet_client" location include from page header section
In both methods is has been loaded files from the same location. aspnet_client folder is normally locate under "C:\inetpub\wwwroot\aspnet_client" if you use default configurations while you installing IIS server. Now you know the place where your toolbar image files are located, but why the system is unable to locate them? Due to various reasons this might be happened. Whatever the reason if we could tell the IIS server where these image files are located, your problem is solved and report will work fine. So the easiest method to define files in any location IIS server manager is to create a virtual directory. If you analyze the above two code sections you will notice that all the path have been defined with respect to "aspnet_client" folder. So that you need to create virtual directory under your web site which will locate the "aspnet_client" folder.
Fig 3: Add Virtual Directory To Web Site
Virtual directory alias should be "aspnet_client" and browse the "aspnet_client" folder from physical path field. Reset you IIS server and browse your web site and see how your report viewer is loading your report without any error.
Still you are facing any issues, please feel free to mention them under comment section so that we can find solution for them as well.
Good Luck !
Find more details Crystal Reports 2008: The Complete Reference (Osborne Complete Reference Series)
I have found few ways to overcome this issue and first solution is install Crystal Report Components for .NET using your Visual Studio Installation CD/DVD set. This method is applicable most of the time Vista operating system and XP with newly patches. I have experienced even though the the installation goes well, still problem might persist due to some problems of locating the installed images. Here you need understand that if the installation went well the required images will copy into your hard drive, but some cases the report viewer is unable to locate them. If the problem is still persist you can go into next solution where install "crredist2005_x86.msi" from SAP website or Upgrade Crystal Reports 2008 Win Nul. Business Object's Crystal Report Viewer is distributed by SAP and they have provide installation for Crystal Report Views as well. In same way you can install this msi file and check whether your problem is solved. This will install "Crystal Reports for .NET Framework 2.0 (x86)" into the system and it is having all the necessary components to run your report in crystal report viewer.
Above two methods are not very specific and blindly hit the target. But try them first and most of the time you will get happy results. But still if you are getting same error you have another method. After install above components and still you have error means all necessary components have been installed properly but your report viewer is unable to locate the images. Then easies them is locate your image file location and register with your report viewer. How you can do this? This depends on the way you have programmed your report. You have basically two methods to program either you can define all the parameters when your create your report viewer.
Fig 1: CR:CrystalReportViewer code section
or if you drag and drop the report viewer control from toolbox of visual studio editor it will insert the report viewer component separately and it takes all the configuration details by including "default.css" style sheet from "C:\inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\css\default.css" in header section of the page.
Fig 2: "aspnet_client" location include from page header section
In both methods is has been loaded files from the same location. aspnet_client folder is normally locate under "C:\inetpub\wwwroot\aspnet_client" if you use default configurations while you installing IIS server. Now you know the place where your toolbar image files are located, but why the system is unable to locate them? Due to various reasons this might be happened. Whatever the reason if we could tell the IIS server where these image files are located, your problem is solved and report will work fine. So the easiest method to define files in any location IIS server manager is to create a virtual directory. If you analyze the above two code sections you will notice that all the path have been defined with respect to "aspnet_client" folder. So that you need to create virtual directory under your web site which will locate the "aspnet_client" folder.
Fig 3: Add Virtual Directory To Web Site
Virtual directory alias should be "aspnet_client" and browse the "aspnet_client" folder from physical path field. Reset you IIS server and browse your web site and see how your report viewer is loading your report without any error.
Still you are facing any issues, please feel free to mention them under comment section so that we can find solution for them as well.
Good Luck !
Find more details Crystal Reports 2008: The Complete Reference (Osborne Complete Reference Series)
Thanks a lot bro, i found that article extremly helpful for me.
ReplyDeleteregrads,
"SOHAIL" from Pakistan.
Thank you alot
ReplyDeleteI can view teh images now
Pishkari from IRAN
Extremely helpful article. Thank you!
ReplyDeleteYou are a real Genius.. Thank you so much
ReplyDelete問題解決了!!!Thanks!
ReplyDeletewow this realy works.Thank you so much.
ReplyDeleteRegards,
Sunil Nikam
(India)
Hi All,
ReplyDeleteI added a image(my company logo)on my crystal report (version CR2008), and integrated with VS2005 asp.net webapplication , image was displayed on my report. and my code is here
CrystalReport1 oRpt = new CrystalReport1();
CrystalReportViewer1.ReportSource= oRpt;
but at the runtime i was unable to find image on the crystal report. its like "X image"(image box displaying.
How can i solve this problem.
Really really gr8 solutions...thanks a lot bro!!
ReplyDeleteIts Great Really Guys............
ReplyDelete