Trouble binding ObjectDataSource to custom class in programmatically created report

0 Answers 8 Views
.NET Core DataSource Object General Discussions Localization Programming
Jim
Top achievements
Rank 1
Jim asked on 09 Sep 2025, 09:32 AM

Hello Telerik team,

I’m trying to create a simple Telerik report programmatically and bind data from a custom class using an ObjectDataSource. My class has a method GetCustomers() that returns a collection of items.

Simplified setup:

var report = new Telerik.Reporting.Report();

var objectDataSource = new Telerik.Reporting.ObjectDataSource();
objectDataSource.DataSource = typeof(CustomerDetailedModel);
objectDataSource.DataMember = "GetCustomers"; // returns IEnumerable<CustomerDetailedModel>

report.DataSource = objectDataSource;


I’ve also tried leaving DataMember

unset, but I still get an error related to assembly trust or type resolution, e.g.,

“The type or namespace ‘CustomerDetailedModel’ could not be found, or the assembly is not trusted.”

I’ve tried:

  • Adding the DLL via AssemblyRef.FromFile

  • Placing the DLL in the application output folder

  • Using AppDomain.CurrentDomain.AssemblyResolve

  • Configuring assembly references in appsettings.json

Despite this, the report cannot resolve the type at runtime.

Questions:

  1. How do I make ObjectDataSource resolve a CLR type from a custom assembly in a programmatically created report?

  2. What is the recommended way to configure assembly references in .NET Core / .NET 8 for reports?

Any guidance or examples would be greatly appreciated.

No answers yet. Maybe you can help?

Tags
.NET Core DataSource Object General Discussions Localization Programming
Asked by
Jim
Top achievements
Rank 1
Share this question
or