ReportViewer add Parameters ...

Posted by user95542 on Stack Overflow See other posts from Stack Overflow or by user95542
Published on 2009-07-18T19:03:02Z Indexed on 2010/05/14 21:04 UTC
Read the original article Hit count: 618

Filed under:

Hi,

I need help.Well, i need add image logo in reportviewer dynamically.I get  this image from db, convert toBase64 and  i need add  in reportviewer.... this code next..

rpViewer.LocalReport.EnableExternalImages = true;

        Company _company = db.Companys.Where(c => c.codCompany == c.codCompany).Single();

        //first step
        byte[] img = _company.imagem.ToArray();   //  i get image from db
        MemoryStream _ms = new MemoryStream(img);

        string logo = Convert.ToBase64String(img); //convert to base64

        // 2 step  
        List<ReportParameter> lstReportParams = new List<ReportParameter>();//Create params
        lstReportParams.Add(new ReportParameter("Logo", logo));
        lstReportParams.Add(new ReportParameter("LogoMimeType", "image/png"));

        this.rpViewer.LocalReport.SetParameters(lstReportParams); // Here don´t  work´s

{"An error occurred during local report processing."} {"An attempt was made to set a report parameter 'Logo' that is not defined in this report."}

        this.rpViewer.RefreshReport();

       In Rldc....

MIMEType =Parameters!LogoMimeType.value Value ="System.Convert.FromBase64String(Parameters!Logo.Value)"

Why not work?

Why is not recognizing the parameter?

need help urgente.I can load that image in reportviewer...Thank´s..

© Stack Overflow or respective owner

Related posts about reportviewer