Passing multi-value parameter from VB to Telerik Report

8 posts, 1 answers
  1. Shady
    Shady avatar
    13 posts
    Member since:
    Oct 2016

    Posted 11 Dec 2016 Link to this post

    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,

  2. Katia
    Admin
    Katia avatar
    693 posts

    Posted 12 Dec 2016 Link to this post

    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
  3. Shady
    Shady avatar
    13 posts
    Member since:
    Oct 2016

    Posted 12 Dec 2016 in reply to Katia Link to this post

    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.

  4. Katia
    Admin
    Katia avatar
    693 posts

    Posted 13 Dec 2016 Link to this post

    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
  5. Shady
    Shady avatar
    13 posts
    Member since:
    Oct 2016

    Posted 13 Dec 2016 in reply to Katia Link to this post

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

  6. Shady
    Shady avatar
    13 posts
    Member since:
    Oct 2016

    Posted 13 Dec 2016 in reply to Shady Link to this post

    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.

  7. Answer
    Katia
    Admin
    Katia avatar
    693 posts

    Posted 14 Dec 2016 Link to this post

    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
  8. Shady
    Shady avatar
    13 posts
    Member since:
    Oct 2016

    Posted 14 Dec 2016 in reply to Katia Link to this post

    Thank you for your help.

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

    Thanks again,

Back to Top