[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Document.PageDocument.Parameters

Parameters Property

Parameters

Gets the collection of parameters defined in the report.

Declaration
public ParameterCollection Parameters { get; }
Property Value
Type Description
ParameterCollection

A ParameterCollection containing the parameters for the current report. Returns null if the report processor is not initialized.

Remarks
<p>

This property provides access to the report parameters, allowing you to get or set their values before the report is rendered.

Examples

This example demonstrates how to access parameters and set their values using the collection.

// Load a page report
PageReport pageReport = new PageReport(new FileInfo("Report1.rdlx"));
pageReport.Document.Load();

// Check if parameter exists before accessing
if (pageReport.Document.Parameters.Contains("EmployeeID"))
{
    var singleParam = pageReport.Document.Parameters["EmployeeID"];
    // Scenario A: Setting a value for a single-value parameter
    singleParam.CurrentValue = 12345;
}

if (pageReport.Document.Parameters.Contains("Regions"))
{
    var multiParam = pageReport.Document.Parameters["Regions"];
    // Scenario B: Setting values for a multi-value parameter
    multiParam.CurrentValue = new string[] { "North", "South" };
}

// 3. Iterating through parameters
foreach (var param in pageReport.Document.Parameters)
{
    Console.WriteLine($"Name: {param.Name}, Value: {param.CurrentValue}");
}