Dear Programer,
Anyone have a solution for my issue,
I want to load Images on PageLoad using Parameters from my database.
here is my code that is not load images and display blank field...!!!
protected void ImageLoad()
{
string RegdPhoto = "";
string RegdSign = "";
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["care_cnn"].ConnectionString;
cnn.Open();
lblsturegdno.Text = Request.QueryString["Id"];
lblrndrpwd.Text = Request.QueryString["Pwd"];
SqlCommand cmd = new SqlCommand("select * from kycimages where Id = '" + lblsturegdno.Text + "' and Pwd = '" + lblrndrpwd.Text + "'", cnn);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
RegdPhoto = rdr["Photo"].ToString();
RegdSign = rdr["Sign"].ToString();
}
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Stu_KYC/New_Regd Print.rdlc");
ReportViewer1.LocalReport.EnableExternalImages = true;
string imagePath = new Uri(Server.MapPath("~/Img/ecc-logo.PNG")).AbsoluteUri;
ReportParameter p = new ReportParameter("ImagePath", imagePath);
ReportParameter p1 = new ReportParameter("Parameter_Photo", RegdPhoto);
ReportParameter p2 = new ReportParameter("Parameter_Sign", RegdSign);
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p1, p2, });
ReportViewer1.LocalReport.Refresh();
Warning[] warnings;
string[] streamIds;
string mimeType = "";
string encoding = "";
string extension = "";
//ReportParameter[] param = new ReportParameter[3];
//param[0] = new ReportParameter("ImagePath", imagePath);
//ReportViewer1.LocalReport.SetParameters(param);
byte[] bytes = ReportViewer1.LocalReport.Render(
"PDF",
null,
out mimeType,
out encoding,
out extension,
out streamIds,
out warnings);
Response.ClearContent();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(bytes);
Response.Flush(); // send it to the client to download
Response.Clear();
Response.End();
}