I am using this code in asp.net to run crystal report :
paramField.Name = "@ORDER_ID";
paramDiscreteValue.Value = TXTORDERID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramField = new ParameterField(); // <-- This line is added
paramDiscreteValue = new ParameterDiscreteValue(); // <-- This line is added
paramField.Name = "@branch_id";
paramDiscreteValue1.Value = TXTDEPTID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue1);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = false;
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
reportDocument.Load(Server.MapPath("~/RPT/RPTCCOVIDRESULTS.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
CrystalReportViewer1.RefreshReport();
when I remove this line of code its run always same report automatically :
CrystalReportViewer1.RefreshReport();
when I add this line its ask always for parameters .
How to referesh the report automatically and run the report without asking each time for order and branch id , I confused about it and I need your help please .
see image and thank you
2
Answers
try to use this code
instead of parameter fields this is complete solution and works with me
try to use the api viewer core 😉
Before invoke RefreshReport() method, then
it works for me in WPF