Back to Devexpress

LookUpColumnInfo.FieldName Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-lookupcolumninfo.md

latest5.1 KB
Original Source

LookUpColumnInfo.FieldName Property

Gets or sets the field name whose values are displayed in the column.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue("")]
[DXCategory("Data")]
public string FieldName { get; set; }
vb
<DefaultValue("")>
<DXCategory("Data")>
Public Property FieldName As String

Property Value

TypeDefaultDescription
StringString.Empty

The name of the field whose values are displayed in the column.

|

Remarks

Use the FieldName property to bind the column to a specific field. Binding to nested fields (e.g., Address.Country ) is not supported. If binding to nested fields is required, use the GridLookUpEdit control instead.

If FieldName refers to a field from the editor’s RepositoryItemLookUpEditBase.DataSource, the column is populated automatically with values from this field.

It is possible to create unbound columns, i.e., columns which you should populate manually by handling the RepositoryItemLookUpEdit.GetNotInListValue event. To do this, you must set its field name to a string that does not match any field name within the RepositoryItemLookUpEditBase.DataSource. Refer to the RepositoryItemLookUpEdit.GetNotInListValue topic for an example.

Use the LookUpColumnInfo.Caption property to specify the string to display in the header panel for the current column.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FieldName 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.

winforms-lookup-custom-draw-rows-cells-column-headers/CS/WindowsApplication3/Main.cs#L18

csharp
LookUpEdit edit = sender as LookUpEdit;
if (IsServiceColumn(edit, e.Column.FieldName)) {
    e.Appearance.BackColor = Color.Blue;

winforms-lookup-show-custom-tooltips/CS/LookUpEditWithHints/PopupLookUpEditHintsForm.cs#L69

csharp
column = this.OwnerEdit.Properties.Columns[i];
if (column.FieldName == le.Properties.DescriptionField)
{

winforms-lookup-custom-draw-rows-cells-column-headers/VB/WindowsApplication3/Main.vb#L18

vb
Dim edit As LookUpEdit = TryCast(sender, LookUpEdit)
If IsServiceColumn(edit, e.Column.FieldName) Then
    e.Appearance.BackColor = Color.Blue

winforms-lookup-show-custom-tooltips/VB/LookUpEditWithHints/PopupLookUpEditHintsForm.vb#L57

vb
column = OwnerEdit.Properties.Columns(i)
If Equals(column.FieldName, le.Properties.DescriptionField) Then
    columnPos = i

See Also

DataSource

GetNotInListValue

Caption

LookUpColumnInfo Class

LookUpColumnInfo Members

DevExpress.XtraEditors.Controls Namespace