How to pass parameter into report through URL

2017-08-23

Working with reports on the Internet, there is a need to transmit the values of any parameters. This, for example, can be data for filtering lists or customer information. It would be convenient to pass parameters using the URL (Universal Resource Locator) when you call the web form with the report. It is quite easy to do this.

Let's consider the simplest example. In the report template, there are two parameters: Param1 and Param2 of type string:

 

You need to pass the values for these parameters using the URL.

Create a web application ASP.Net WebForms. We place a WebReport component on a page. Add the created report template to the project. Right-click on the folder App_Data and select «Add-> Existing Item ...». Then we find the report file on the hard disk. Now go to the C # code page. First of all, we add libraries: 

1
2
using FastReport.Web;
using FastReport;

 I used the Load page event, because at this stage the report is not yet displayed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
namespace URLParams
{
 public partial class About : Page
 {
 protected void Page_Load(object sender, EventArgs e)
 {
//Get parameters from URL
 string param1 = Request.QueryString["param1"];
 string param2 = Request.QueryString["param2"];
//Load report fil into WebReport object 
 
 WebReport1.ReportFile = "App_Data/URLParams.frx";
//Set value to report parameters
 WebReport1.Report.SetParameterValue("Param1", param1);
 WebReport1.Report.SetParameterValue("Param2", param2);
 }
 }
}

 Note that the parameter name exactly matches the parameter name in the report template:

1
WebReport1.Report.SetParameterValue("Param1", param1);

 The URL looks like this:

http://localhost:51838/About?param1=Hello%20World!&param2=Good%20job!

The Request.QueryString(); function finds the parameter by name and returns its value.

The second option, without saving the report template in the project:       

1
2
3
4
5
6
7
8
9
10
 protected void Page_Load(object sender, EventArgs e)
 {
 string param1 = Request.QueryString["param1"];
 string param2 = Request.QueryString["param2"];
 Report report = new Report();
 report.Load("J:/Program Files (x86)/FastReports/FastReport.Net/Demos/Reports/URLParams.frx");
 report.SetParameterValue("Param1", param1);
 report.SetParameterValue("Param2", param2);
 WebReport1.Report = report;
}

 Here, we create a report object, load a template into it, and assign parameters. After that, we assign the report object to the web report object. Forgive me for the tautology. At the same time, make sure that the property of the ReportResourceString WebReport is empty.

Both methods lead to the same result:

 

Thus, just a few lines of code allow you to use parameters passed in the URL.

.NET .NET FastReport FastReport ASP.NET ASP.NET WebReport WebReport
March 04, 2026

Overview of .NET 10: What's New in C# 14, ASP.NET Core, WinForms, and MAUI

Microsoft has released .NET 10 with long-term support (LTS). The release has not brought about a revolution but rather a host of targeted, mature improvements. This article highlights the key points.
February 17, 2026

How to Install FastReport Desktop on Windows and Linux

In this article, we will outline the detailed steps for installing, configuring, and launching the FastReport Desktop installer, with examples for each platform.
February 06, 2026

FastReport VCL: How 25 Years of Innovation Changed the Approach to Reporting in VCL Applications

We decided to take a look back to demonstrate how reporting technologies have changed and to trace the key stages of FastReport VCL development in each version.

© 1998-2026 Fast Reports Inc.