I want to pass parameters tho the report using Blazor native viewer. I found some samples with HTML viewer but the code doesn't work for the native viewer. Do you have a sample of how to implement it?
I try implementing a custom resolver but until now it is not working.
1 Answer, 1 is accepted
0
Dimitar
Telerik team
answered on 05 Jul 2023, 08:52 AM
Hi Sami,
When it comes to updating the values of the report parameter of the native Blazor Report Viewer from code, in order to do so, you need to re-assign a whole new ReportSourceOptions object to the property bound to the Report Viewer's ReportSource, for example:
<buttononclick="@RefreshViewer">Refresh with new parameter value</button><ReportViewerServiceUrl="/api/reports"
@ref=rv1@bind-ReportSource="@ReportSource"
@bind-ScaleMode="@ScaleMode"
@bind-ViewMode="@ViewMode"
@bind-ParametersAreaVisible="@ParametersAreaVisible"
@bind-DocumentMapVisible="@DocumentMapVisible"
@bind-Scale="@Scale"PageMode="@PageMode.ContinuousScroll"EnableSendEmail="true"ServiceType="@ReportViewerServiceType.REST"Height="800px"Width="100%"></ReportViewer>
@code {
...
public ReportSourceOptions ReportSource { get; set; } = new ReportSourceOptions(
"Report1.trdp",
new Dictionary<string, object>
{});
voidRefreshViewer()
{
ReportSource = new ReportSourceOptions() { Report = ReportSource.Report, Parameters = new Dictionary<string, object>() { { "parameter", "value" } } };
}