Using Telerik BlazorNative ReportViewer with compiled .Designer.cs reports

0 Answers 8 Views
Report Viewer - Blazor
Antoine
Top achievements
Rank 1
Antoine asked on 05 Dec 2025, 07:57 PM | edited on 08 Dec 2025, 01:07 PM

Hi everyone,

I’m trying to display compiled Telerik reports (.Designer.cs) in a Photino.Blazor desktop application using the BlazorNative ReportViewer.

Here’s what I have so far:

  • I have a local Kestrel web server to be able to serve the REST endpoints required by the Viewer:
   public class Program
   {
       [STAThread]
       public static void Main(string[] args)
       {
           var configuration = new ConfigurationBuilder()
               .SetBasePath(AppContext.BaseDirectory)
               .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
               .AddEnvironmentVariables()
               .Build();

           PhotinoBlazorAppBuilder appBuilder = PhotinoBlazorAppBuilder.CreateDefault(args);

           ConfigureServices(appBuilder.Services, configuration);

           appBuilder.RootComponents.Add<App>("app");

           PhotinoBlazorApp app = appBuilder.Build();

           app.MainWindow.SetSize(700, 460)
               .SetLogVerbosity(0)
               .SetDevToolsEnabled(SystemUtils.IsDevelopment)
               .SetContextMenuEnabled(SystemUtils.IsDevelopment)
               .SetIconFile(iconPath)
               .SetTitle("MyReports");

           AppDomain.CurrentDomain.UnhandledException += (sender, error) =>
           {
               app.MainWindow.ShowMessage("Fatal exception", error.ExceptionObject.ToString());
           };

           string myAllowedOrigins = "_myAllowedOrigins";
           var host = Host.CreateDefaultBuilder()
               .ConfigureServices(services =>
               {
                   services.AddScoped<ReportServiceConfiguration, ReportServiceConfig>();
                   services.AddControllers();

                   services.AddCors(options =>
                   {
                       options.AddPolicy(name: myAllowedOrigins,
                           policy =>
                           {
                               policy.SetIsOriginAllowed(origin => origin.StartsWith("http://localhost"))
                                     .AllowAnyHeader()
                                     .AllowAnyMethod();
                           });
                   }
                   );
               })
               .ConfigureWebHostDefaults(webBuilder =>
               {
                   webBuilder.UseKestrel()
                             .UseUrls("http://localhost:5000")
                             .Configure(appBuilder =>
                             {
                                 appBuilder.UseCors(myAllowedOrigins);
                                 appBuilder.UseStaticFiles();
                                 appBuilder.UseRouting();
                                 appBuilder.UseEndpoints(endpoints =>
                                 {
                                     endpoints.MapControllers();
                                 });
                             });
               })
               .Build();

           host.Start();

           app.Run();
       }
  • I have compiled reports (MyReport.cs/MyReport.Designer.cs/MyReport.resx) instead of .trdp files.
  • I tried creating a report source using InstanceReportSource, like this:
var reportInstance = Factories.ReportFactory.CreateReport(_selectedReport.ReportCode);
_reportSource = new InstanceReportSource { ReportDocument = reportInstance };


In my Razor page:

<ReportViewer ReportSource="@_reportSource"
              ViewMode="@_viewMode"
              ScaleMode="@_scaleMode"
              Height="600px"
              Width="100%" />


Problem:

  • The BlazorNative <ReportViewer> expects a ReportSourceOptions type for ReportSource, not InstanceReportSource.
  • If I use ReportSourceOptions, I’m not sure how to pass compiled .Designer.cs reports and parameters.

 

Questions:

  • How can I correctly display a compiled .Designer.cs report in BlazorNative/Photino using <ReportViewer>?
  • How do I pass parameters to the report if I use ReportSourceOptions?
  • Do I need to switch to .trdp files, or can I make compiled reports work locally?
Lance | Senior Manager Technical Support
Telerik team
commented on 05 Dec 2025, 08:23 PM

Hi Antoine,

Your suspicion is correct, legacy type-based reports (i.e. C# reports) are not supported with modern HTML Report Viewers like the BlazorReportViewer. You can only use modern trdp/trdx reports. To understand this better, please read the followings doc section => Report Sources at a Glance - Telerik Reporting.

While yes you can create an instance report source (from the C# report) on the server side, there's not much you can do with that object in the web app's front end with it... except export it in memory and have the user download the exported document (e.g. PDF file).

 

Support Note

If you would like technical support with this migration, please ask Denis [deducted for privacy] to assign the license to your account using the Manage Licensed Users page. He has access to an excellent technical support plan. However, he cannot assign a single license to a common "webdev@companyname" and have multiple developers use that license to develop with (or open support cases). This is a violation of the EULA because licenses are one-license-per-developer, but that dev can develop infinite apps and run it on infinite machines.

No answers yet. Maybe you can help?

Tags
Report Viewer - Blazor
Asked by
Antoine
Top achievements
Rank 1
Share this question
or