Skip to main content

DxDataGridColumn.Caption Property

Specifies the column’s caption.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[Parameter]
public string Caption { get; set; }

Property Value

Type Description
String

The column’s caption.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Use the Caption property to specify a custom column caption.

If this property is set to an empty string, the Data Grid generates a user-friendly column caption based on the field name (the Field property value). The Grid adds space characters between parts of the field name that begin with uppercase letters. For instance, the “Temperature C“ caption is displayed for the TemperatureC field.

@inject WeatherForecastService ForecastService

<DxDataGrid Data="@DataSource" PageSize="5">
    <DxDataGridDateEditColumn Field="Date" DisplayFormat="D" />
    <DxDataGridColumn Field="Forecast" />
    <DxDataGridColumn Field="CloudCover" />
    <DxDataGridSpinEditColumn Field="TemperatureC"
                              Caption="@("Temp. (\x2103)")"
                              TextAlignment="@DataGridTextAlign.Left"
                              Width="150px" />
    <DxDataGridSpinEditColumn Field="TemperatureF"
                              Caption="@("Temp. (\x2109)")"
                              TextAlignment="@DataGridTextAlign.Left"
                              Width="150px" />
</DxDataGrid>

@code {
    public class WeatherForecast {
        public DateTime Date { get; set; }
        public int TemperatureC { get; set; }
        public bool Precipitation { get; set; }
        public string Forecast { get; set; }
        public double TemperatureF => Math.Round((TemperatureC * 1.8 + 32), 2);
        public string CloudCover { get; set; }
    }
}

Data Grid - Custom column caption

Run Demo: Data Grid - Column Types

See Also