Friday, October 14, 2016

How To Set Textbox1 Value Into Formula Field Of Cystal Reports.


As per client requirement he/she want to selected date dispaly on report(Crystal Report).

Solution : 

Step1 : I have create one formula field "mindate" and "maxdate" in crystal report.

Step2 : Create the instance of the reports class and set the texbox value in crystalreportviwer source.

Example : 

I have used as per my code in aspx.cs in code page.

CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["mindate"].Text = "'" + Search_FromDate.Value.Trim() + "'";
CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["maxdate"].Text = "'" + Search_ToDate.Value.Trim()+ "'";
CrystalReportViewer1.ReportSource = CrystalReportSource1;

Note ["mindate"] ,["maxdate"] is the formula field name. which provided into crystal reports.

Result: See Below Image