Back to Devexpress

Parameter.Name Property

corelibraries-devexpress-dot-xtrareports-dot-parameters-dot-parameter-5dc4f17c.md

latest8.8 KB
Original Source

Parameter.Name Property

Specifies a name by which you can reference a parameter in a report.

Namespace : DevExpress.XtraReports.Parameters

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[Browsable(false)]
[DefaultValue("")]
public string Name { get; set; }
vb
<DefaultValue("")>
<Browsable(False)>
Public Property Name As String

Property Value

TypeDefaultDescription
StringString.Empty

A parameter name.

|

Remarks

Report parameters should have unique names. A name should not contain C# keywords or XtraReport‘s property names.

Example

To create a parameter in code, initialize a Parameter class instance and specify its properties. Add the parameter to the report’s Parameters collection.

The code sample below demonstrates how to create a date parameter, specify an expression for the parameter’s default value, and reference the parameter in a label‘s expression.

csharp
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
using DevExpress.XtraReports.Parameters;
// ...
using DevExpress.XtraReports.Expressions;
// ...
// Create a date report parameter.
// Use an expression to specify the parameter's default value.
var dateParameter = new Parameter() {
    Name = "date",
    Description = "Date:",
    Type = typeof(System.DateTime),
    ExpressionBindings = { new BasicExpressionBinding("Value", "Now()") }
};

// Create a label and bind the label's Text property to the parameter value.
// Use the parameter's name to reference the parameter in the label's expression.
var dateLabel = new XRLabel() {
    ExpressionBindings = { new ExpressionBinding("Text", "?date") },
    BoundsF = new RectangleF(0, 0, 200, 50),
};

// Create a report and add the label to the report's Detail band.
var report = new XtraReport() {
    Bands = { new DetailBand() { Controls = { dateLabel } } },
};

// Add the parameter to the report's Parameters collection.
report.Parameters.Add(dateParameter);
vb
Imports DevExpress.XtraReports.UI
' ...
Imports DevExpress.XtraReports.Parameters
' ...
Imports DevExpress.XtraReports.Expressions
' ...
' Create a date report parameter.
' Use an expression to specify the parameter's default value.
Dim dateParameter = New Parameter() With {
    .Name = "date",
    .Description = "Date:",
    .Type = GetType(Date)
}

dateParameter.ExpressionBindings.Add(New BasicExpressionBinding("Value", "Now()"))

' Create a label and bind the label's Text property to the parameter value.
' Use the parameter's name to reference the parameter in the label's expression.
Dim dateLabel = New XRLabel() With {.BoundsF = New RectangleF(0, 0, 200, 50)}

dateLabel.ExpressionBindings.Add(New ExpressionBinding("Text", "?date"))

' Create a report and add the label to the report's Detail band.
Dim report = New XtraReport()
Dim band = New DetailBand()
band.Controls.Add(dateLabel)
report.Bands.Add(band)

' Add the parameter to the report's Parameters collection.
report.Parameters.Add(dateParameter)
'

The following code snippets (auto-collected from DevExpress Examples) contain references to the Name property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-parameter-daterange/CS/Program.cs#L22

csharp
var dateRangeParam = new Parameter();
dateRangeParam.Name = "dateRange";
dateRangeParam.Description = "Date Range:";

reporting-winforms-parameter-multivalue/CS/Program.cs#L27

csharp
Parameter parameter1 = new Parameter();
parameter1.Name = "CategoryIDs";
parameter1.Type = typeof(System.Int32);

reporting-winforms-implement-custom-parameter-editor/CS/XtraReport1.cs#L18

csharp
foreach (var info in e.ParametersInformation) {
    if (info.Parameter.Name == "shape") {
        info.Editor = radioGroup;

reporting-winforms-add-report-parameters/CS/ReportParameterExample/Form1.cs#L17

csharp
Parameter param1 = new Parameter();
param1.Name = "CatID";

reporting-winforms-parameter-dynamic-list/CS/Form1.cs#L28

csharp
Parameter param = new Parameter();
param.Name = "employeePosition";
param.Description = "Employee position:";

reporting-winforms-parameter-daterange/VB/Program.vb#L19

vb
Dim dateRangeParam = New Parameter()
dateRangeParam.Name = "dateRange"
dateRangeParam.Description = "Date Range:"

reporting-winforms-parameter-static-list/VB/Form1.vb#L35

vb
Dim dateParameter As New Parameter()
dateParameter.Name = "dateParameter"
dateParameter.Description = "Date:"

reporting-winforms-implement-custom-parameter-editor/VB/XtraReport1.vb#L23

vb
For Each info In e.ParametersInformation
    If info.Parameter.Name = "shape" Then
        info.Editor = radioGroup

reporting-winforms-add-report-parameters/VB/ReportParameterExample/Form1.vb#L19

vb
Dim param1 As Parameter = New Parameter()
param1.Name = "CatID"
' Specify other parameter properties.

reporting-winforms-parameter-dynamic-list/VB/Form1.vb#L27

vb
Dim param As New Parameter()
param.Name = "employeePosition"
param.Description = "Employee position:"

Implements

Name

See Also

Use Report Parameters

RequestParameters

Type

Value

Description

Visible

Parameter Class

Parameter Members

DevExpress.XtraReports.Parameters Namespace