Click here to Skip to main content
15,063,479 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.
Faizymca 21-Jun-13 6:07am
   
when i give simple path of field name PhotoImagePath
An error occurred during local report processing.
Report 'Report' contains external images. The EnableExternalImages property has not been set for this report
Faizymca 21-Jun-13 6:15am
   
Sir what option choose by me Image Source External,Database,Embedded
i choose external is it right ....???
RelicV 21-Jun-13 6:18am
   
Try setting it to Database is not correct as image is not saved in Db. External is the correct option. Have you set the EnableExternalImages to true..?. Have to look at the report to give you a proper answer.
Faizymca 22-Jun-13 1:05am
   
thank ...sir it's right option....yes, I set the EnableExternalImages is true on my aspx.cs page code ....i store only path of image in table ...i also try folder name + path in table in my store procedure which are called in this field...('ImgUpload'+PhotoImagePath)as Photo this...type where i setting that image show ....help
Faizymca 22-Jun-13 1:25am
   
i updated page.cs code in question list....pls see.... your point of view...
raj ch 21-Jun-13 3:19am
   
use a subreport to bind the image.
Faizymca 21-Jun-13 5:57am
   
Sorry i am new so i don't have idea how can used sub report in report ....
i develop report only except image all field are come according to requirement...but image is not come actually i save the path in data table.......please give answere in step by step...that how can i solve
PrissySC 24-Jun-13 11:28am
   
Check the properties, select the image source as external. Set the enableexternalimages to true before the display/refresh. Under use this image select the field that stores the image path and when doing so make sure that you are showing correctly. What I mean is that the path for a server starts with a "/". More than likely your string is incorrectly stored. On a local with a relatvie path - ../images/myimageshow.jpg

You could use a paramter and pass the path.

Faizymca 26-Jun-13 6:33am
   
Yes ...It's work when i write path in properties this type (="http://localhost:2731" & First(Fields!PhotoImagePath.Value, "DataSet1")) and remove (~) from table 's datafield replaced \ImgUpload\baba.JPG....its doing right work.....

But i want path pass in parameter how can right server name in parameter and don't need for removed (~) from datatable

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