locked
Value display in Crystal report RRS feed

  • Question

  • User639567535 posted

    how to display textbox value in report

    Wednesday, August 10, 2016 8:24 AM

Answers

  • User-2057865890 posted

    Hi Bakhtawar,

    First define the parameters in the crystal report and then pass value from code behind.

    //@RegionParameter is the parameter you added at the design of the crystalReport and RegionParameterValue is the value 
    crystalReport.SetParameterValue("@RegionParameter", RegionParameterValue); 
    //@FromDateParameter is the parameter you added at the design of the crystalReport and FromDateParameterValue is the value crystalReport.SetParameterValue("@FromDateParameter", FromDateParameterValue);
    //@ToDateParameter is the parameter you added at the design of the crystalReport and ToDateParameterValue is the value crystalReport.SetParameterValue("@ToDateParameter", ToDateParameterValue);

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 11, 2016 6:37 AM

All replies

  • User-2057865890 posted

    Hi Bakhtawar,

    First define the parameters in the crystal report and then pass value from code behind.

    //@RegionParameter is the parameter you added at the design of the crystalReport and RegionParameterValue is the value 
    crystalReport.SetParameterValue("@RegionParameter", RegionParameterValue); 
    //@FromDateParameter is the parameter you added at the design of the crystalReport and FromDateParameterValue is the value crystalReport.SetParameterValue("@FromDateParameter", FromDateParameterValue);
    //@ToDateParameter is the parameter you added at the design of the crystalReport and ToDateParameterValue is the value crystalReport.SetParameterValue("@ToDateParameter", ToDateParameterValue);

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 11, 2016 6:37 AM
  • User639567535 posted

    thanku for reply

    i add formula field region,fromdate,todate in report

    i.e.

    and then i try this

    protected void Report_Click(object sender, EventArgs e)
            {
                
                ReportDocument crystalReport = new ReportDocument();
    
                crystalReport.SetParameterValue("@region", regiondrop);
    
                crystalReport.SetParameterValue("@fromdate", fromdate);
    
                crystalReport.SetParameterValue("@todate", todate); 
    
    
               
                BindReport(crystalReport,Convert.ToDateTime(fromdate.Value), Convert.ToDateTime(todate.Value), regiondrop.SelectedValue);
             
    
            }

    but this show error

    An exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code

    Additional information: Invalid report file path.

    also i try this another method

     CrystalDecisions.CrystalReports.Engine.ReportDocument doc = crystalReport;
                doc.DataDefinition.FormulaFields["region"].Text = regiondrop.SelectedValue;
    
                CrystalDecisions.CrystalReports.Engine.ReportDocument doc1 = crystalReport;
                doc1.DataDefinition.FormulaFields["fromdate"].Text = fromdate.Value;
    
                CrystalDecisions.CrystalReports.Engine.ReportDocument doc2 = crystalReport;
                doc2.DataDefinition.FormulaFields["todate"].Text = todate.Value;

    but this also show same error

    An exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code
    
    Additional information: Invalid report file path.
    Thursday, August 11, 2016 6:55 AM
  • User-2057865890 posted

    Hi Bakhtawar,

    An exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code Additional information: Invalid report file path.

    The application cannot find your report file, or doesn't have read permissions on the directory where the report is stored.

    Best Regards,

    Chris

    Friday, August 12, 2016 3:41 PM