Hi, I am using VB.NET web application with Telerik Reporting (standalone designer) where I am passing some parameters from VB.net code to the Telerik report, as shown below.
ReportViewer1.ReportSource.Parameters.Add(New Telerik.Reporting.Parameter("FromDate", dtpFromDate.SelectedDate))
ReportViewer1.ReportSource.Parameters.Add(New Telerik.Reporting.Parameter("ToDate", dtpToDate.SelectedDate))
This works fine for a single-value parameter, however, how can I pass on a multivalue parameter from VB.net to the Report. For instance, I am using a radCheckBoxList where the user can select more than one selection. How to pass the radCheckBoxList selected items/values to the multivalued parameter.
Thanks in advance,
7 Answers, 1 is accepted
Passing value for multivalue report parameter can be achieved as following:
reportSource.Parameters.Add(
"Parameter1"
,
New
String
() {
"1"
,
"2"
})
To have multiple values selected, you need to pass an IEnumerable instance containing the desired values - Using Multivalue Parameters.
Note that the parameter value is evaluated against the data retrieved from the parameter's AvailableValues.DataSource property.
Thus, the values you pass with ReportSource.Parameters should be of the same type as the report parameter and be present in AvailableValues values.
Regards,
Katia
Telerik by Progress

Hi, thank you for the feedback, the query works well when i feed the values in the code below:
ReportViewer1.ReportSource.Parameters.Add("Type_ID", {"3", "4"})
However, the values should be obtained from a radCheckBoxList (selected values). How do I do that?
Appreciate your support.
The is no direct way for setting the value of report parameter to the values from RadCheckBoxList control as it is not a native reporting element.
The values from the radCheckBoxList need to be collected using the custom logic and after that passed as a value with ReportSource.Parameters collection.
With HTML5 Report Viewer, you can use custom parameters UI and introduce your own logic for handling report parameters - How To: Pass Values to Report Parameters.
Regards,
Katia
Telerik by Progress

Hi, thank you for the feedback Katia. This is exactly what I am trying to do, but how?
"The values from the radCheckBoxList need to be collected using the custom logic and after that passed as a value with ReportSource.Parameters collection."

Just to clarify, i am not using HTML5 Report viewer, below is my report viewer:
<telerik:ReportViewer ID="ReportViewer1" CssClass="report" BorderStyle="None" runat="server" Width="100%" BackColor="white" ViewMode="PrintPreview" ShowZoomSelect="true" ShowHistoryButtons="false" ShowDocumentMapButton="true">
<urireportsource uri="C:\WEBDIR\pulse\web\report\files\Report4.trdp"></urireportsource>
</telerik:ReportViewer>
Looking forward to your feedback.
RadCheckBoxList.SelectedValues will return a collection of all selected checkboxes values (RadCheckBoxList common features (properties)) which you can later pass to ReportSource.Parameters.
In case, you are experiencing an issue with obtaining the values from RadCheckBoxList please post a question in the respective forum or open a support ticket and choose Telerik UI for ASP.NET AJAX as a product.
Regards,
Katia
Telerik by Progress

Thank you for your help.
ReportViewer1.ReportSource.Parameters.Add("Type_ID", RadCheckBoxList1.SelectedValues) did the job.
Thanks again,