c# - How to render RDLC to PDF in IE and Opera -
my question seems duplicate question have strange issue here. have web application render rdlc reports pdf format has parameter set in code append report , render pdf. have code behind:
localreport rep = new localreport(); rep.reportpath = "reimbursementclaimform.rdlc"; list<reportparameter> param = new list<reportparameter>(); param.add(new reportparameter("nameofthepatient", txtnameofthepatient.text)); param.add(new reportparameter("mbasidno", txtmbasidno.text)); param.add(new reportparameter("dateofbirth", string.format("{0:dd mmmm, yyyy}", convert.todatetime(txtdateofbirth.text)))); param.add(new reportparameter("completehomeaddress", txtcompletehomeaddress.text)); param.add(new reportparameter("emailaddress", txtemailaddress.text)); param.add(new reportparameter("contactnos", txtcontactnos.text)); param.add(new reportparameter("expenseclaim", txtexpenseclaim.text)); param.add(new reportparameter("accountholdername", txtaccountholdername.text)); param.add(new reportparameter("accountholdername2", txtaccountholdername2.text)); param.add(new reportparameter("accountnoandaccounttype", txtaccountnoandaccounttype.text)); param.add(new reportparameter("bankname", txtbankname.text)); param.add(new reportparameter("bankbranch", txtbankbranch.text)); param.add(new reportparameter("bankcontactno", txtbankcontactno.text)); param.add(new reportparameter("bankaddress", txtbankaddress.text)); param.add(new reportparameter("bicswiftcode", txtbicswiftcode.text)); param.add(new reportparameter("rtgscode", txtrtgscode.text)); param.add(new reportparameter("iban", txtiban.text)); rep.setparameters(param); rep.displayname = "reimbursementclaimform"; rep.refresh(); httpcontext.current.response.buffer = true; //httpcontext.current.response.clear(); httpcontext.current.response.appendheader("content-disposition", "attachement filename=" + rep.displayname + ".pdf"); httpcontext.current.response.contenttype = "application/pdf"; warning[] warnings; string[] streamids; string mimetype; string encoding; string extension; byte[] bytes = item.render("pdf", null, out mimetype, out encoding, out extension, out streamids, out warnings); httpcontext.current.response.binarywrite(bytes); httpcontext.current.response.flush(); httpcontext.current.response.end();
the problem here whenever deploy app using code values on reportparameter set values of textboxes on asp not reflected in generated pdf file. @ first try values rendered on second time around values not updated on pdf. happens on ie , opera browsers on other browsers fine , take note once web app deployed on iis on local machine works fine in browsers. in advance.
most caching issues. add line on response.clear()
httpcontext.current.response.cache.setcacheability(httpcacheability.nocache);
clear browser cache , try again
Comments
Post a Comment