Skip to main content
A newer version of this page is available. .

GridColumn.FieldName Property

To bind a column to a data source field, set this property to the required data field name. To create an 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 FieldName property value to identify the column.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v19.1.dll

Declaration

[DXCategory("Data")]
[DefaultValue("")]
[XtraSerializableProperty]
public string FieldName { get; set; }

Property Value

Type Default Description
String String.Empty

A String value that specifies the unique column field name.

Remarks

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.FormatRules.Add(lengthRule);

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;
    }
};

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.

See Also