Reputation: 79
The image path is stored in the SQL Server 2008 database. On my RDLC report, I have a image field. I have set this field to get the image path from the database column in the database. I also have set in the report viewer the "EnableExternalImages" property to true. I don't know what I am missing, but the only "image" my report shows is the red mark. What am I missing?
Upvotes: 2
Views: 20449
Reputation: 27
reportViewer.LocalReport.ReportPath = @"Report Path";
reportViewer.LocalReport.EnableExternalImages = true;
ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
ReportParameter[] param = new ReportParameter[1];
param[0] = parameter;
reportViewer.LocalReport.SetParameters(param);
reportViewer.RefreshReport();
Upvotes: -1
Reputation: 79
The problem was that I did set the image source property of the image control on the report to "database", which is incorrect. Because the image is not saved in the database, but only the path to it. So I changed it to "External" and walah! It works like a charm. Thank you all for your help.
Upvotes: 1
Reputation: 4352
For display the external image in RDLC report,
You have to set EnableExternalImages to true.
The file path you are using should be absolute path. The path you are using should be in the form of "file:///C:/RDLCTest/TestImage.png".
Also, you have to set the MIME type for the image control. Each file type has its own MIME type. Refer http://webdesign.about.com/od/multimedia/a/mime-types-by-file-extension.htm for list of MIME types based on file extension.
Upvotes: 4