Back to Devexpress

XRControl.Name Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-dd5d46a8.md

latest6.3 KB
Original Source

XRControl.Name Property

Gets or sets a name of the control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.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 String that is the control’s name. It should start with a letter or underscore (_).

|

Remarks

The Name property identifies a control in the collection. You can use the parent control’s FindControl method to find a control by its name in the collection of child controls.

The name of a report control should be a valid C# identifier and meet the following requirements:

  • it is not a reserved .NET word, library name or XtraReport class property name (DataSource, Version, etc.)
  • it starts with a letter or an underscore (_)
  • it does not contain spaces
  • it is unique in the collection.

When you use the Report Designer to add a control, the name is generated automatically. You do not have to specify a name at runtime if you do not intend to use it in your code.

The Report Designer validates the name entered in the Properties window and displays an error message if validation fails. Incorrect names are replaced with automatically generated values at runtime.

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-web-forms-handle-server-side-errors/CS/DXWebApplication1/Reports/XtraReport3.cs#L46

csharp
//
this.TopMargin.Name = "TopMargin";
//

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/CS/Form1.cs#L204

csharp
chart.Location = new Point(0, 0);
chart.Name = "xrChart1";

reporting-winforms-provide-authentication-to-access-json-data/CS/Form1.cs#L107

csharp
i++;
jsonDS.ConnectionName = string.Format("newJsonConnection_{0}{1}", report.Name, i.ToString());

reporting-winforms-export-report-to-xlsx-format/CS/Form1.cs#L38

csharp
@"\Downloads\" +
report.Name +
".xlsx";

reporting-conversion-vsrepx-tool/CS/HelperProject/ConverterComponent.cs#L67

csharp
ConversionResult res = converter.Convert(file);
res.TargetReport.Name = targetReport.Name;
return res;

reporting-web-forms-handle-server-side-errors/VB/DXWebApplication1/Reports/XtraReport3.vb#L45

vb
'
Me.TopMargin.Name = "TopMargin"
'

reporting-wpf-use-private-custom-font-distributed-with-application/VB/PrivateFontDemo/SampleReport.vb#L30

vb
Detail.Controls.AddRange(New XRControl() {lbText})
Detail.Name = "Detail"
Detail.Padding = New DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F)

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/VB/Form1.vb#L200

vb
chart.Location = New Point(0, 0)
chart.Name = "xrChart1"

reporting-winforms-provide-authentication-to-access-json-data/VB/Form1.vb#L107

vb
i += 1
jsonDS.ConnectionName = String.Format("newJsonConnection_{0}{1}", report.Name, i.ToString())

reporting-winforms-export-report-to-xlsx-format/VB/Form1.vb#L21

vb
' Specify the path for the exported XLSX file.
Dim xlsxExportFileName As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & "\Downloads\" & report.Name & ".xlsx"
' Export the report.

See Also

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace