Madhav

Madhav

  • NA
  • 196
  • 43k

display image on crystal report using web.config file

May 23 2016 12:33 AM
here i want to display image on crystal report using web.config file in which i am storing image path ,from folder in which i have images in solution
 
here i added image path in web.config file within appsetting section like bellow
 
<appSettings>
<add key="logo" value="Images/1.jpg" />
</appSettings>
 
 and i have tried code as bellow in c#
 
 
 
CrystalReportViewer1.Visible = true;
string imagePath = ConfigurationManager.AppSettings["logo"];
string physicalPath = Server.MapPath(imagePath);
ReportDocument rd = new ReportDocument();
CrystalReportViewer1.RefreshReport();
ParameterFields myParams = new ParameterFields();
ParameterField myParam = new ParameterField();
ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();
myParam.ParameterFieldName = "logo";
myDiscreteValue.Value = physicalPath;
myParam.CurrentValues.Add(myDiscreteValue);
myParams.Add(myParam);
CrystalReportViewer1.ParameterFieldInfo = myParams;
rd.Load(Server.MapPath("CrystalReport2.rpt"));
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.DataBind();
 
 but the crystal report viewer doesn't rendering any thing,can any one help me regarding this issue
 
 
 
 

Answers (1)