i want to pass the text box value to crystal report . i have added one parameter named "JoiningDate" in parameters fields and that parameter field i have added in .rpt files {?JoiningDate}. how to add my parameter in the code behind.
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("~/ExperienceLetter.rpt"));
DataSet dsCustomers = GetData("select top 1 * from employees");
crystalReport.SetDataSource(dsCustomers);
CrystalReportViewer1.ReportSource = crystalReport;
string dateValue = txtJoiningDate.Text;
crystalReport.SetParameterValue("@JoiningDate", dateValue);
if you just want to show text value , i sagest use the code below .
TextObject txtObj = (TextObject)crystalReport.ReportDefinition.Sections["GroupHeaderSection1"].ReportObjects["Text10"];
but for some logic or calculations use model binding .. Visit: http://tektutorialshub.com/how-to-create-crystal-report-using-visual-studio/
TextObject text = (TextObject)cr.ReportDefinition.Sections["Section3"].ReportObjects["Text1"];
text.Text = textBox1.Text;
here is simple example explaining it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.