How to load dynamic JSON data into a .trdp report in Blazor?

1 Answer 3 Views
DataSource JSON DataSources Report Designer (standalone) Report Viewer - Blazor
Balamuraly
Top achievements
Rank 1
Balamuraly asked on 23 Jun 2025, 07:21 AM

I'm trying to generate a report in my Blazor application.

What I’ve done so far:

  • I used the Standalone Report Designer to create a sample report based on JSON data.
  • I saved the report as a .trdp file and embedded it into my Blazor project.
  • Using the Telerik Report Viewer, I was able to display the report successfully in the app.

Now here's what I want to do:

  • I have dynamic JSON data generated within my Blazor application at runtime.
  • I want to use this runtime JSON data to populate the existing .trdp report.

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 Jun 2025, 02:50 PM

Hi Balamuraly,

We have already been discussing this case in a private ticket, however, since you have opened this public thread, I will try to summarise my reply from the ticket, plus your reply, on what the users can do in scenarios such as yours.

Yes, it is possible to dynamically provide JSON data to your report from the Blazor application. The most straightforward way to do this would be through a report parameter - Setting the content of JsonDataSource through report parameter - Telerik Reporting.

Note that to send the JSON through the parameter, it should be made into a string in the Blazor application before being provided to the corresponding report parameter. Essentially, you would need to serialize your data - How to serialize JSON in C# - .NET | Microsoft Learn, before sending it to the report.

For example, using the HTML5 Blazor Report Viewer with a report where the approach mentioned above is applied:

public ReportSourceOptions ReportSource { get; set; }

public class ReportDataModel
{
    public string StockID { get; set; }
    public string StockName { get; set; }
    public string Quantity { get; set; }
    public string Rate { get; set; }
    public string Amount { get; set; }
}

protected override void OnInitialized()
{
    var demoData = new ReportDataModel
    {
        StockID = "6",
        StockName = "Kotak Bank",
        Quantity = "39",
        Rate = "1649.28",
        Amount = "64321.92"
    };

    var jsonData = JsonSerializer.Serialize(demoData);

    ReportSource = new ReportSourceOptions("SampleReport.trdp", new Dictionary<string, object>
    {
        { "ReportData", jsonData }
    });

    base.OnInitialized();
}

I hope that the provided information is helpful.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataSource JSON DataSources Report Designer (standalone) Report Viewer - Blazor
Asked by
Balamuraly
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or