How to set parameters programmatically

In order to add parameters in Silverlight Viewer for SSRS programmatically, it's necessary to create an object of PerpetuumSoft.ReportingServices.Viewer.Client.Parameter type. You need to set the value of the parameter's name in the "Name", set the value of the parameter in the "Value" and then add new parameter to the parameter's collection of the ReportViewer object.

For example:
PerpetuumSoft.ReportingServices.Viewer.Client.Parameter reportParameter1 = 
new PerpetuumSoft.ReportingServices.Viewer.Client.Parameter();
reportParameter1.Name = "ParameterName";
reportParameter1.Value = "ParameterValue";
reportViewer.Parameters.Add(reportParameter1);
If your parameter is multi-select and you want to set several values for this parameter, you just need to specify all these values.
It can be done as follows:
PerpetuumSoft.ReportingServices.Viewer.Client.Parameter reportParameter1 =
new PerpetuumSoft.ReportingServices.Viewer.Client.Parameter();
reportParameter1.Name = "MultiSelectParameter";
reportParameter1.Value = "1";
reportViewer.Parameters.Add(reportParameter1);
reportParameter1 = new 
PerpetuumSoft.ReportingServices.Viewer.Client.Parameter();
reportParameter1.Name = "MultiSelectParameter";
reportParameter1.Value = "3";
reportViewer.Parameters.Add(reportParameter1);
In this case in your report in the Report Builder the parameter should have following properties:



For example, we have following values for the MultiSelectParameter:



Then, after setting several values programmatically in the code we will get the result:

Add Feedback