views:

1118

answers:

2

I searched google for days to show images on .rdlc datareports but still not found s soulition.
I have set:
reportViewer1.LocalReport.EnableExternalImages = true;
Image properties to "External" and have set parameters value to the value property.

 ReportParameter Path;
        Path = new ReportParameter("Path", "C:\\Test\\579569.png");
        this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { Path });  

But still i get a broken image. Is there something i am missing.I am trying this in Winforms. I know this question is asked by others..but i didnt get the result wat i wanted.

Thanks in advance

A: 

Hi, Have you tried setting MIME Type property to ImageControl in the rdlc file ? Best Regards, Iordan

IordanTanev
A: 

Your paths in an RDLC have to be URIs, then the string you pass to the ReportParameter is the AbsolutePath (in your case file:///C:/Test/579569.png)

    Dim filepath As Uri
    filepath = New Uri("C:\Test\579569.png")

    Dim Path As ReportParameter
    Path = New ReportParameter("Path", filepath.AbsolutePath)

    Me.reportViewer1.LocalReport.SetParameters(New ReportParameter() {Path})

Excuse VB.Net code but you get the idea.

hawbsl
Actually, instead of filepath.AbsolutePath, you shoud use filepath.AbsoluteUri (at least for the latest report viewer)
Tejo