I have a report in which the set parameter value is set but when I run the script it always prompts for the value of the parameter. Here is the code I used:
Customer_List1.SetParameterValue("IsSubs", subs);
Customer_List1.Database.Tables["Customer_List"].SetDataSource((DataTable)dt);
crv_customer_list.ReportSource = Customer_List1;
crv_customer_list.Refresh();
Customer_List1 is the report and crv_customer_list is the crystalreportviewer
I have used similar code in another form of the same project, It works absolutely fine there. Please do help with this
As discussed in comments, writing the solution as an answer.
The sequence of statements is your problem. You are setting parameter values before initialization. The correct sequence should be:
Customer_List1.Database.Tables["Customer_List"].SetDataSource((DataTable)dt);
crv_customer_list.ReportSource = Customer_List1;
Customer_List1.SetParameterValue("IsSubs", subs);
crv_customer_list.Refresh();