Skip to Content
0
Sep 20 at 10:40 AM

Logo image not displaying in Crystal Report Subreport C# ASP.NET MVC

189 Views

I am new to Crystal Reports in ASP.net MVC. I have a main report with a logo from a subreport. The subreport is a separate .rpt file that gets its data from an image saved in the database in a binary string format. This logo's datatype when checked in the xsd is String.Byte[].

However, when I run the report viewer in the web browser, no image is being displayed. Even when I click on the box of the logo in the web browser and the separate rpt file is loaded, the report is blank.

I can confirm that this specific logo saved in the DB can be displayed in the report viewer when I tried to add a column for the image in the stored procedure that is used to populate and dragged that field in my main report.

I hope someone can help me as I am stuck here for days. This is what my code looks like in the report viewer:

        report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Height = 1500; //Convert.ToInt32(reportParam.CRParameters["COMPANYLOGOHEIGHT"]);
        report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Width = 5250; //Convert.ToInt32(reportParam.CRParameters["COMPANYLOGOWIDTH"]);
        report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Left = 13;

        report.SetDataSource(reportParam.DataSource["Table"]);
        report.Subreports["Logo"].SetDataSource(reportParam.DataSource["Logo"]);

        StatementOfHoldingsReport.ReportSource = report;

I believe I am missing something when the image is being displayed in the separate sub report. I can also confirm that the string of bytes can be found in the row of the reportParam.DataSource["Logo"].