Reputation: 315
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);
Upvotes: 0
Views: 4808
Reputation: 1473
TextObject text = (TextObject)cr.ReportDefinition.Sections["Section3"].ReportObjects["Text1"];
text.Text = textBox1.Text;
here is simple example explaining it.
Upvotes: 1
Reputation: 85
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/
Upvotes: 1