Skip to main content

DxGridDataColumn.UnboundType Property

Indicates that the column is unbound and specifies its data type.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(GridUnboundColumnType.Bound)]
[Parameter]
public GridUnboundColumnType UnboundType { get; set; }

Property Value

Type Default Description
GridUnboundColumnType Bound

An enumeration value.

Available values:

Name Description
Bound

The column is bound to a data field. This field specifies the column data type.

Integer

The column contains Int32 values.

Decimal

The column contains Decimal values.

DateTime

The column contains DateTime values.

String

The column contains String values.

Boolean

The column contains Boolean values.

Object

The column contains Object values.

Remarks

To create an unbound column, add a DxGridDataColumn object to the Columns collection and specify the column’s UnboundType and FieldName properties. The FieldName property value should be unique and should not match field names in the Grid’s data source.

You can use the following API to obtain column values:

UnboundExpression
Specifies an expression to evaluate values for the unbound column. An expression might consist of field names, constants, operators, and functions.
UnboundColumnData
Allows you to implement custom logic or obtain column values from a custom/external data source.
<DxGrid Data="forecasts" UnboundColumnData="Grid_CustomUnboundColumnData">
    <Columns>
        <DxGridDataColumn FieldName="Date" Caption="Date" />
        <DxGridDataColumn FieldName="TemperatureC" Caption="@("Temperature (\x2103)")" />
        <DxGridDataColumn FieldName="TemperatureF" Caption="@("Temperature (\x2109)")"
                          UnboundType="GridUnboundColumnType.Decimal"
                          UnboundExpression="32 + [TemperatureC] / 0.5556" />
        <DxGridDataColumn FieldName="Summary"
                          UnboundType="GridUnboundColumnType.String" />
    </Columns>
</DxGrid>

@code {
    private WeatherForecast[]? forecasts;

    protected override async Task OnInitializedAsync() {
        forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
    }

    void Grid_CustomUnboundColumnData(GridUnboundColumnDataEventArgs e) {
        if (e.FieldName == "Summary") {
            int temperature = Convert.ToInt32(e.GetRowValue("TemperatureC"));
            e.Value = GetTemperatureString(temperature);
        }
    }

    static string GetTemperatureString(int value) {
        if (value < -10)
            return "Cool";
        if (value >= -10 && value < 5)
            return "Chilly";
        if (value >= 5 && value < 15)
            return "Warm";
        return "Hot";
    }
}

DevExpress Blazor Grid - Unbound Columns

View Example: Create and Edit Unbound Columns

Limitations

Implements

See Also