This is a migrated thread and some comments may be shown as answers.

Passing multi-value parameter from VB to Telerik Report

7 Answers 422 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Shady
Top achievements
Rank 1
Shady asked on 12 Dec 2016, 03:43 AM

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

Sort by
0
Katia
Telerik team
answered on 12 Dec 2016, 04:08 PM
Hi Shady,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shady
Top achievements
Rank 1
answered on 12 Dec 2016, 06:20 PM

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.

0
Katia
Telerik team
answered on 13 Dec 2016, 02:44 PM
Hi Shady,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shady
Top achievements
Rank 1
answered on 13 Dec 2016, 03:07 PM

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."

0
Shady
Top achievements
Rank 1
answered on 14 Dec 2016, 04:05 AM

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.

0
Accepted
Katia
Telerik team
answered on 14 Dec 2016, 01:36 PM
Hello Shady,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shady
Top achievements
Rank 1
answered on 14 Dec 2016, 05:53 PM

Thank you for your help.

ReportViewer1.ReportSource.Parameters.Add("Type_ID", RadCheckBoxList1.SelectedValues) did the job.

Thanks again,

Tags
Report Designer (standalone)
Asked by
Shady
Top achievements
Rank 1
Answers by
Katia
Telerik team
Shady
Top achievements
Rank 1
Share this question
or