We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ReportViewer (BoldReportsAPIController) global variable access


I have a Report.razor page

@code {


     public string repName { get; set; } = "";


     protected Data.LoginState LoginState { get; set; }


public async void RenderReportViewer()


         viewerOptions.ReportName = repName;

         viewerOptions.ServiceURL = "/api/BoldReportsAPI";

         await JSRuntime.InvokeVoidAsync("BoldReports.RenderViewer", "report-viewer", viewerOptions);


-------------------------------------------------- -------------------

And in BoldReportsAPIController


         public void OnInitReportOptions(ReportViewerOptions reportOption)


                 string basePath = _hostingEnvironment.WebRootPath;

                 reportOption.ReportModel.ProcessingMode = ProcessingMode.Local;

                 FileStream inputStream = new FileStream(basePath + @"\resources\" + reportOption.ReportModel.ReportPath + ".rdlc", System.IO.FileMode.Open, System.IO.FileAccess.Read);

                 MemoryStream reportStream = new MemoryStream();


                 reportStream.Position = 0;


                 reportOption.ReportModel.Stream = reportStream;

This is where I need to create the data for the report

reportOption.ReportModel.DataSources.Add(new BoldReports.Web.ReportDataSource { Name = "DSDzial", Value = Date });

How to read the LoginState value here?

I need user data to read from the database.

(LoginState works as





1 Reply

AM Arumugasami Murugesan Syncfusion Team February 20, 2023 11:17 AM UTC

Hi Maciej,

Thanks for contacting Bold Reports support.

Using ajaxBeforeLoad event, we can pass the data from razor page to API controller. Please refer to the below documentation for your reference..



Arumugasami M

Live Chat Icon For mobile
Up arrow icon