Hi
What I am doing I think is fairly simple, but I am struggling to find how to do it. I would like to use the Bold ReportViewer in a Blazor Server page. However, rather than exporting the RDL file to the Blazor website and referencing the RDL file from there, is it possible to run and view the SSRS report directly from our SQL Server. Also if possible I would like to be able to send parameters to the report from controls in the Blazor page.
There seem to be ways to do this with the javascript control but I cannot find how to integrate this within a Blazor page. Are there any examples?
Regards
Martin
Hi Arumugasami,
something it's not clear to me. As per provided examples, there is no way to connect to a SSRS server, because the relevant service API method refers to a RDL file saved in wwwroot static files.
I mean this method from service API:
public void OnInitReportOptions(ReportViewerOptions reportOption)
where I find
FileStream fileStream = new FileStream(basePath + @"\Report\"+ reportOption.ReportModel.ReportPath + ".rdl",
FileMode.Open, FileAccess.Read);
So, how may I pass the SSRS serverURL (i.e. https://mydomain/ReportServer)? As well as folder name and report name? Is it a FileStream, in this scenario, the right .NET object to use?
The BoldReportViewerOptions, inside razor component page, has no properties regarding SSRS server URL.
It should be excellent to have an example regarding a SSRS server, not a RDL local file.
Thank You
Paolo
Hi Martin,
Thanks for the update,
Bold Reports report viewer has support for loading RDL reports from SSRS Report Server. You need to pass the ReportServerUrl and report name as shown in the below code snippet. We have prepared a sample application in Blazor application and attached it.
public void OnInitReportOptions(ReportViewerOptions reportOption) { reportOption.ReportModel.ReportServerUrl = http://synclapn24026/ReportServer; reportOption.ReportModel.ReportPath = "/SSRS"; } |
Please refer to the below documentation for your reference.
https://help.boldreports.com/embedded-reporting/aspnet-core-reporting/report-viewer/ssrs-report/
Regards,
Arumugasami M
Hi Arumugasami,
thank you for providing code. Well, it works... but I get a problem:
I consume the Report Service from Blazor Server App. But I create the relevant controller in an existing REST API, because the Blazor App already consume other API methods. Is this approach possible, or the Report Service Controller has to be included in Blazor Server App project (as per your example)?
Is it possible to have some more details regarding the reported failure? So I could fix it...
Thank you
Paolo
Hi Arumugasami,
moving the API controller into the Blazor Server App project, I fixed the problem. So, is it not possible to connect to an external REST API?
Anyway I need to change the code in the controller method OnInitReportOptions, because the report name, set in the razor component page, it's not passed into the controller. Only hard coding the following lines, I am able to see the report:
reportOption.ReportModel.ReportPath = _config.GetValue<string>("SSRS:ReportPath") + "/UsciteCasaPerMese"; (this last is the report name, the configuration value is the path
In this way I cannot launch more than 1 report.... any solution?
Best regards
Paolo
Hi Paolo,
Thanks for the update,
Please find the details from the below table,
Query |
Response |
moving the API controller into the Blazor Server App project, I fixed the problem. So, is it not possible to connect to an external REST API?
|
Yes, It is possible to connect to an external REST API. Please refer to the below documentation for your reference. |
Anyway I need to change the code in the controller method OnInitReportOptions, because the report name, set in the razor component page, it's not passed into the controller. Only hard coding the following lines, I am able to see the report: reportOption.ReportModel.ReportPath = _config.GetValue<string>("SSRS:ReportPath") + "/UsciteCasaPerMese"; (this last is the report name, the configuration value is the path
|
If you want to change the report name in the controller file, you need to use the below code snippet as shown in the below snap.
boldreports-interop.js
Controller |
In this way I cannot launch more than 1 report.... any solution?
|
Yes, you can create more than one report. You need to create one main report and follow it up with sub-reports. Please refer to the below documentation to design the rdl report using the sub report. Please refer to the below documentation for your reference. |
Regards,
Arumugasami M