Reporting Input Field in Blazor

2 Answers 13 Views
Report Parameters Report Viewer - Blazor
Serkan
Top achievements
Rank 1
Iron
Serkan asked on 03 Jun 2025, 08:19 AM

Hello Together,

i use Blazor Wasm. I created a Reporting with a TextBox

 

And i put a TextBox in the Blazor Client. My goal is, to put a text in the textbox and the text in the reporting will be change. but how can i do it?

Thanks for your support

 

This is my client Code:


@page "/druck"

<PageTitle>Report Viewer</PageTitle>

<TelerikTextBox @bind-Value="@Bezeichnung"></TelerikTextBox>

<ReportViewer ServiceType="@ReportViewerServiceType.REST"
              ServiceUrl="/api/Reports"
              @bind-ReportSource="@ReportSource"
              @bind-ScaleMode="@ScaleMode"
              @bind-ViewMode="@ViewMode"
              @bind-ParametersAreaVisible="@ParametersAreaVisible"
              @bind-DocumentMapVisible="@DocumentMapVisible"
              @bind-Scale="@Scale">
</ReportViewer>

@code {
    public ScaleMode ScaleMode { get; set; } = ScaleMode.Specific;
    public ViewMode ViewMode { get; set; } = ViewMode.Interactive;
    public bool ParametersAreaVisible { get; set; }
    public bool DocumentMapVisible { get; set; }
    public double Scale { get; set; } = 1.0;
    public string Bezeichnung { get; set; } = string.Empty;

    public ReportSourceOptions ReportSource { get; set; } = new ReportSourceOptions("Report1.trdp",
        new Dictionary<string, object>
        {
            // Add parameters if applicable
        });
}

 

 

Controller Reporting Code:


using System.Net.Mail;
using System.Net;

using LIMeS.Shared;
using LIMeS.Shared.Utils;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

using Telerik.Reporting.Services;
using Telerik.Reporting.Services.AspNetCore;

/// <summary>
/// The LIMeS.Server.Controllers namespace contains all the controllers for the Action Management Server.
/// </summary>
/// 
namespace LIMeS.Server.Controllers
{
    /// <summary>
    /// The main controller for managing action types.
    /// </summary>
    [ApiController]
    [Route("api/[controller]")]
    public class ReportsController : ReportsControllerBase
    {
        public ReportsController(IReportServiceConfiguration reportServiceConfiguration)
            : base(reportServiceConfiguration)
        {
        }

        protected override HttpStatusCode SendMailMessage(MailMessage mailMessage)
        {
            throw new System.NotImplementedException("This method should be implemented in order to send mail messages");
        }
    }
}

 

2 Answers, 1 is accepted

Sort by
1
Accepted
Petar
Telerik team
answered on 06 Jun 2025, 04:04 PM

Hello Serkan,

Thank you for providing all the relevant information.

The most straightforward solution I can think of is to use report parameters, which can be updated dynamically through the ReportSourceOptions option. Report parameters allow you to send dynamic information from the client to the Reporting REST service. By changing these parameters, the report will be re-rendered to reflect the updated values from the textbox. An example implementation might look as follows:

	<TelerikTextBox ValueChanged="@MyValueChangeHandler"></TelerikTextBox>
	<ReportViewer ServiceType="@ReportViewerServiceType.REST"
				  ServiceUrl="/api/Reports"
				  @bind-ReportSource="@ReportSource"
				  @bind-ScaleMode="@ScaleMode"
				  @bind-ViewMode="@ViewMode"
				  @bind-ParametersAreaVisible="@ParametersAreaVisible"
				  @bind-DocumentMapVisible="@DocumentMapVisible"
				  @bind-Scale="@Scale">
	</ReportViewer>

@code {
	public ScaleMode ScaleMode { get; set; } = ScaleMode.Specific;
	public ViewMode ViewMode { get; set; } = ViewMode.Interactive;
	public bool ParametersAreaVisible { get; set; }
	public bool DocumentMapVisible { get; set; }
	public double Scale { get; set; } = 1.0;
	public string Bezeichnung { get; set; } = string.Empty;

	public ReportSourceOptions ReportSource { get; set; } = new ReportSourceOptions("SampleReport.trdp", new Dictionary<string, object>());


	private void MyValueChangeHandler(string userInput)
	{
		Bezeichnung = userInput;
		ReportSource = new ReportSourceOptions("SampleReport.trdp", new Dictionary<string, object>
		{
			{ "Parameter1", Bezeichnung }
		});
	}
}

For more information on how to add a report parameter to your report, please refer to Approaches for Adding Report Parameters

Could you please let me know if such a solution suits your needs? I am looking forward to your reply!

Regards,
Petar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Serkan
Top achievements
Rank 1
Iron
answered on 11 Jun 2025, 02:04 PM
Thank you it works. :)
Tags
Report Parameters Report Viewer - Blazor
Asked by
Serkan
Top achievements
Rank 1
Iron
Answers by
Petar
Telerik team
Serkan
Top achievements
Rank 1
Iron
Share this question
or