Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone
I'm using microsoft report viewer 2010. I want to show image which are store in application folder and path are save in data table (databse) when
XML
I insert Image conrol on my report take the properties select image sourceExternal and
give the expression in Use this Image --when i write this type code in
=First(Fields!PhotoImagePath.Value,DataSet1)

Show this type error---An error occurred during local report processing.
Report 'Report' contains external images. The EnableExternalImages property has not been set for this report.

and the expression in Use this Image --when i write this type code in
=@~\ImgUpload\+First(Fields!PhotoImagePath.Value, DataSet1)

show the error....this type---The Value expression for the image ‘Image1’ contains an error: [BC30201] Expression expected.

Dear Concerned,
                I want to show image according name of member in table
table view this type...table abc

S.N.   Name   ImageName         PhotoImagePath
1      AAA           DSCN0231.JPG    ~\ImgUpload\baba.JPG
2      BBB           DSCN0230.JPG    ~\ImgUpload\kam.JPG
3      CCC           DSCN0228.JPG    ~\ImgUpload\bla.png

 page code that type code...

          protected void btnShowReport_Click(object sender, EventArgs e)
    {
        try
        {
            int Language;
            string ReportPath, QueryParams, Query, QueryHeader, LanguagePostFlix;

            string MyCulture = Session["MyCulture"].ToString();

            QueryParams = ddlWard.SelectedValue; // +",";
            if (MyCulture == "en-GB")
            {
                Language = 1;
                LanguagePostFlix = "English.rdlc";
            }
            else
            {
                Language = 2;
                //LanguagePostFlix = "Hindi.rdlc";
                LanguagePostFlix = ".rdlc";
            }
            QueryParams += ", " + Language.ToString();

            if (txtHouseNo.Text != string.Empty)
                QueryParams += ",'" + txtHouseNo.Text.Trim() +"'";
            else
                QueryParams += "," + "-1";

            if (txtFamilyHeadName.Text != string.Empty)
                QueryParams += ",'" + txtFamilyHeadName.Text.Trim()+"'";
            //QueryParams += "," + float.Parse(txtFamilyHeadName.Text.Trim());
            else
                QueryParams += "," + "-1";

            QueryHeader = "Exec spGetHeader '" + MyCulture + "'";

            SqlDataAdapter daHeader = new SqlDataAdapter(QueryHeader, strconstring);
            dsPRReport.spGetHeaderDataTable dtHeader = new dsPRReport.spGetHeaderDataTable();
          
            daHeader.Fill(dtHeader);
            Query = "Exec spPRCertificate " + QueryParams;

            SqlDataAdapter da = new SqlDataAdapter(Query, strconstring);
            dsPRReport.spPRReportDataTable dt = new dsPRReport.spPRReportDataTable();

            da.Fill(dt);

            ReportPath = @"Reports\PRCertificate" + LanguagePostFlix;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath(ReportPath);

       
            List<reportparameter> rptPrmtr = new List<reportparameter>();
            rptPrmtr.Add(new ReportParameter("rptPrmtrPRCertificate", ddlWard.SelectedItem.Text.Trim()));
            rptPrmtr.Add(new ReportParameter("rptPrmtrPRCertificate1", Language.ToString()));
            rptPrmtr.Add(new ReportParameter("rptPrmtrPRCertificate2", txtHouseNo.Text.Trim()));
            rptPrmtr.Add(new ReportParameter("rptPrmtrPRCertificate3", txtFamilyHeadName.Text.Trim()));
           
            //rptPrmtr.Add(new ReportParameter("rptImage" ));

          
            //rptPrmtr.Add(new ReportParameter("PhotoImagePath", Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + @"~/ImgUpload/"));
       
            ReportDataSource crds = new ReportDataSource("DataSet1", (DataTable)dt);
            ReportDataSource crdsHeader = new ReportDataSource("DataSet2", (DataTable)dtHeader);

            ReportViewer1.LocalReport.DataSources.Clear();

            ReportViewer1.LocalReport.DataSources.Add(crds);
            ReportViewer1.LocalReport.DataSources.Add(crdsHeader);
            ReportViewer1.LocalReport.SetParameters(rptPrmtr);

            ReportViewer1.LocalReport.EnableExternalImages = true;
            ReportViewer1.ZoomMode = ZoomMode.Percent;



            ReportViewer1.LocalReport.Refresh();
        }

        catch (Exception ex) { lblMessage.Text = ex.Message; lblMessage.Visible = true; }





    }</reportparameter></reportparameter>
Posted
Updated 21-Jun-13 19:27pm
v9
Comments
RelicV 20-Jun-13 2:59am    
So, you got the issue solved or still having any issues..?
Faizymca 21-Jun-13 1:07am    
problem is still....not show the image on my rdlc report...
RelicV 21-Jun-13 2:29am    
Okay. Have you developed the reports using BIDS or Visual Studio..?
Faizymca 21-Jun-13 5:49am    
yes i developed the rdlc report using Visual Studio 2010....
RelicV 21-Jun-13 5:57am    
Hey, if you look at the Data, it already contains "~\ImgUpload" in the ImagePath column, if i assume that above table is your data only. And again you'r trying to add that in the expression [=@"~\ImgUpload\"...]. Remove that and check it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900