2
votes

I am developing a website using ASP.NET. I use crystal report as a reporting tool. I use this code to load the report

          rpt.Load(Server.MapPath("~\\Reports\\A4\\GrnDetailReport-A4.rpt"));

          rpt.SetParameterValue("DateFrom", dtimeFrom);
          rpt.SetParameterValue("DateTo", dtimeTo);
          rpt.SetParameterValue("CompanyId",ddCompanyNames.SelectedValue);
          rpt.SetParameterValue("LocationId", ddLocations.SelectedValue);

          CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;


        CrystalReportViewer1.ReportSource = rpt;
        CrystalReportViewer1.DataBind();

So above code working with some issues. Report is loading. But data is not displaying. enter image description here

When I press the refresh button on the page it is displaying. Whats gone wrong there?

I called this function at bottom of above code.

CrystalReportViewer1.RefreshReport();

but still got the problem.

Also when I press the refresh button It is asking for parameter window. How to bypas this window? I am setting parameter values from the code.Do I need to again give these to this window?

1
I updated the answer; have you tried?Emanuele Greco

1 Answers

0
votes

Please try this solution:

  CrystalReportViewer1.ReportSource = rpt;
  rpt.ReadRecords();
  \\CrystalReportViewer1.DataBind();