ReportViewer script in _Host.cshtml

0 Answers 100 Views
Report Viewer - Blazor Report Viewer - HTML5 Rest Service
Andrew
Top achievements
Rank 1
Andrew asked on 24 Feb 2022, 02:19 PM

My Blazor application uses an API for all its data and reporting etc

In my _Host.cshtml I have the following line

@* For Reports service hosted in another application / Report Server use absolute URI: *@
<script src="https://localpc/localapi/api/reports/resources/js/telerikReportViewer"></script>

and the report views OK.

When this goes into production, the localpc/localapi will change, the API will be hosted on the customers server

So, without change my code and re-compiling can I make this variable / configurable?

Thanks

Neli
Telerik team
commented on 01 Mar 2022, 12:57 PM

Hi Andrew,

There are a few options that you can test:

1. Refer to the JS file of the viewer relatively:

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

2. Refer the file locally. You can find it in the installation folder of Telerik Reporting and copy it to the folder with scripts in your project:

C:\Program Files (x86)\Progress\Telerik Reporting R1 2022\Html5\ReportViewer\js

3. Use JS variable to set the src attribute for <script> tag

 

Andrew
Top achievements
Rank 1
commented on 01 Mar 2022, 04:41 PM

Hi

I created a folder in the root of my blazor project and copied the js file into it as below...

then I modified my _Host.cshtml file as below..

All works OK as expected, thank you for the advice!

 

Neli
Telerik team
commented on 02 Mar 2022, 06:44 AM

Hi Andrew,

Thank you for the update.

Only keep in mind that with each upgrade of Telerik Reporting, you need to paste the new version of the JavaScript file of the viewer to your scripts folder.

No answers yet. Maybe you can help?

Tags
Report Viewer - Blazor Report Viewer - HTML5 Rest Service
Asked by
Andrew
Top achievements
Rank 1
Share this question
or