Change Datasource on Telerik Reporting HTML5 Report Viewer Net Core 6

1 Answer 90 Views
.NET Core Report Designer (standalone) Report Viewer - HTML5
Top achievements
Rank 1
Mozart asked on 06 Jul 2023, 06:34 AM


How do we change the datasource of Telerik reporting dynamically using Business Object ?

I'm playing with Sample CSharp.Net6.HtmlIntegration from R1 2023 Telerik Reporting 

Here's my code :


    string report = ViewBag.Report + ".trdp";
<!DOCTYPE html>
<html xmlns="">
    <title>Telerik HTML5 Report Viewer Demo</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

    <script src=""></script>

    <link href="" rel="stylesheet" id="common-css" />
    <link href="" rel="stylesheet" id="skin-css" />

    <script src="/Scripts/themeSwitcher.js"></script>

    <script src="/api/reports/resources/js/telerikReportViewer"></script>

        body {
            font-family: Verdana, Arial, sans-serif;
            margin: 5px;

        #reportViewer1 {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 40px;
            bottom: 5px;
            overflow: hidden;
            clear: both;

        #theme-switcher {
            float: right;
            width: 12em;
            height: 30px;
    <select id="theme-switcher"></select>

    <div id="reportViewer1">

    <script type="text/javascript">

        $(document).ready(function () {
            //Theme switcher

                    serviceUrl: "api/reports/",
                    reportSource: {
                        report: "@report",

                    viewMode: telerikReportViewer.ViewModes.INTERACTIVE,

                    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,

                    scale: 1.0,

                    enableAccessibility: false,

                    //If set to true shows the Send Mail Message toolbar button
                    sendEmail: { enabled: true }




using Microsoft.AspNetCore.Mvc;

namespace CSharp.Net6.Html5IntegrationDemo.Controllers
    public class ReportingController : Controller
        public IActionResult Index(string report)

            ViewBag.Report = report;
            return View("Reporting");


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 10 Jul 2023, 01:48 PM

Hello, Mozart

To set a report DataSource programmatically, you need to implement Custom ReportSource Resolver(you can check Steps for Implementing a Custom ReportSource Resolver telerik documentation article for step by step guide on how to do it) in which you can Unpackage a predefined .TRDP report definition and change your report properties programmatically.

You can also have a look at Using Custom ReportSource Resolver and Custom ReportDocument Resolver - Telerik Reporting to see how to assign DataSource specifically to instantiated objects. 

Regards, Nikolay Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at
.NET Core Report Designer (standalone) Report Viewer - HTML5
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question