Skip to main content
Tab

GridViewDataColumn.FieldName Property

Gets or sets the name of the database field assigned to the current column.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue("")]
public virtual string FieldName { get; set; }

Property Value

Type Default Description
String String.Empty

A String value that specifies the name of a data field.

Remarks

To specify the text which is displayed within the column’s header, use the Caption property.

It is not allowed to set the FieldName property of several columns to the same data source’s field. The FieldName property should be set to a unique value.

For unbound columns, the FieldName should not refer to any field in ASPxGridView’s data source. Refer to the Unbound Columns topic for more information.

The example below demonstrates how to specify the display text for a cell:

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" KeyFieldName="ID" Width="100%" 
    OnCustomColumnDisplayText="grid_CustomColumnDisplayText">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="From" Width="200px" />
        <dx:GridViewDataTextColumn FieldName="Subject" />
        <dx:GridViewDataDateColumn FieldName="Sent" Width="100px" />
        <dx:GridViewDataCheckColumn Caption="Attachment?" FieldName="HasAttachment" Width="100px" />
        <dx:GridViewDataTextColumn FieldName="Size" Width="80px" />
    </Columns>
</dx:ASPxGridView>
protected void grid_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e) {
    if(e.Column.FieldName == "Size")
        e.DisplayText = Utils.FormatSize(e.Value);
}

Run Demo: ASPxGridView - Large Database

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