New to Telerik Reporting? Request free 30-day trial

Object must implement IConvertible

Environment

Product Progress® Telerik® Reporting

Description

I have created an ObjectDataSource component whose data method has a parameter that is of type List<int>. When I try to preview the report, I am met with the below error in place of the data item using said ObjectDataSource.

Steps to Reproduce

  1. Create an ObjectDataSource whose data method expects a list/array of primitive type as one of its parameters.
  2. Create a MultiValue=True Report Parameter and set its value to be passed to the parameter of the ObjectDataSource
  3. Set the value of the report parameter and preview the report.

Error Message

An error has occurred while resolving data source: Object must implement IConvertible

Cause

The Multivalue Report Parameters always return Object[]. As the received Object[] cannot be converted to List<type>, the corresponding ObjectDataSource Parameters cannot be correctly mapped to the Report Parameters.

Solution

Change the type of the ObjectDataSource Parameters using MultiValue to Object[] in one of the following ways:

  • Through the ObjectDataSource Wizard
  • Through the code behind:

    new Telerik.Reporting.ObjectDataSourceParameter("UserNames", typeof(object[]), "= Parameters.UserNames.Value"),
    

See Also

In this article