A newer version of this page is available. Switch to the current version.

GridColumn.FieldName Property

To bind a column to a data source field, set this property to the required data field name. To create unbound columns, assign a unique identifier to this property. If you have obtained a column as a method return value or as an event argument, read the FieldName property value to identify the column.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v19.2.dll


public string FieldName { get; set; }
Public Property FieldName As String

Property Value

Type Default Description


A String value that specifies the unique column field name.


The FieldName property does not affect the column GridColumn.Caption.

The Prioritize conditional formatting appearances demo illustrates how to obtain a column by its FieldName and change this column's appearance.

FormatConditionRuleValue lengthRuleCondition = new FormatConditionRuleValue();
lengthRuleCondition.Condition = FormatCondition.GreaterOrEqual;
lengthRuleCondition.Value1 = 25;
lengthRuleCondition.Appearance.BackColor = Color.MediumSeaGreen;
lengthRuleCondition.Appearance.Options.UseBackColor = true;
GridFormatRule lengthRule = new GridFormatRule() { Column = gridView.Columns["Length"], Rule = lengthRuleCondition };

gridView.RowCellStyle += (s, e) => {
    GridView view = s as GridView;
    if (view.IsRowSelected(e.RowHandle) &&
        e.Column.FieldName == "Length" &&
        lengthRule.IsFit(e.CellValue, view.GetDataSourceRowIndex(e.RowHandle)))
        AppearanceObject ruleAppearance = (lengthRule.Rule as FormatConditionRuleAppearanceBase).Appearance;
        e.Appearance.BackColor = ruleAppearance.BackColor;
  • For unbound columns, unique FieldName values are required. Otherwise, the ColumnView.CustomUnboundColumnData event is unable to find required columns.
  • In the case of data-bound records, it is generally not recommended to have multiple columns bound to the same data field because of multiple limitations this design imposes on Data Grid functionality (inability to access the specific column by the given field name, updates in all related columns when you change a cell value in one of them, unexpected behavior when records are sorted, filtered or groupped, etc.).
See Also