none
Set image path in rdlc report by passing a parameter RRS feed

  • Question

  • Hi all.

    I would like to set an image path to an image i have defined in an rdlc report.
    I set the value of the image path (in the report) to be a parameter string.

    In my aspx page i have a button click even which will go to the report viewer page and pass all the parameters into the report.
    But when i try to pass in an image path as a parameter the report doesn't display the image.

    Is there anything that i can do to fix this.
    Here is my code for the ReportViewer Page

        
       ReportViewer1.LocalReport.ReportPath"PrintReport.rdlc"
            ReportViewer1.ProcessingMode = ProcessingMode.Local; 
            ReportViewer1.LocalReport.EnableExternalImages = true
            ReportParameter [] p = new ReportParameter[1]; 
            if (Session["QuestionOne"] == "Y") 
                p[0] = new ReportParameter("quesOneYes", "./checkboxY.gif"); 
            else 
                p[0] = new ReportParameter("quesOneYes", "./checkboxN.gif"); 
     
            ReportViewer1.LocalReport.SetParameters(p); 
           
            ReportViewer1.LocalReport.Refresh(); 



    Here is my value for the Image in my rdlc report
           
    =Parameters!quesOneYes.Value 



    Is there anything i am doing wrong?
    Saturday, July 19, 2008 3:43 PM

Answers

  •  Just give the full path of the image like the following way:

     ReportViewer1.LocalReport.ReportPath"PrintReport.rdlc"
            ReportViewer1.ProcessingMode = ProcessingMode.Local; 
            ReportViewer1.LocalReport.EnableExternalImages = true
            ReportParameter [] p = new ReportParameter[0]; 
            if (Session["QuestionOne"] == "Y") 
                p[0] = new ReportParameter("quesOneYes", "http://<ServerName>/<VirtualDirectoryName>/checkboxY.gif"); 
            else 
                p[0] = new ReportParameter("quesOneYes", "http://<ServerName>/<VirtualDirectoryName>/checkboxN.gif"); 
     
            ReportViewer1.LocalReport.SetParameters(p); 
           
            ReportViewer1.LocalReport.Refresh(); 

    Aftab Ansari
    • Marked as answer by RiverX Saturday, July 26, 2008 8:35 PM
    Monday, July 21, 2008 7:14 AM