Hi
I have a Report.razor page
@code {
[parameter]
public string repName { get; set; } = "";
[injection]
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
[NonAction]
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();
inputStream.CopyTo(reportStream);
reportStream.Position = 0;
inputStream.Close();
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
builder.Services.AddScoped<LoginState>();)
Thanks
Regards
Maciej