DxDataGridComboBoxColumn<T>.ValueFieldName Property

Specifies the name of the data source field that supplies values for the column items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

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

Property Value

Type Description
String

The field name.

Remarks

The grid populates the combobox column’s items from the specified data source and obtains item characteristics (such as the item text, value or displayed image) from individual data fields.

Use the TextFieldName and ValueFieldName property to specify a data source’s field from which the grid should obtain item texts and values.

<DxDataGrid Data="@Orders">
    <DxDataGridDateEditColumn Field="@nameof(Order.OrderDate)"
                              DisplayFormat="D"
                              Width="240px">
    </DxDataGridDateEditColumn>
    <DxDataGridComboBoxColumn Field="@nameof(Order.CountryId)"
                              Caption="Ship Country"
                              Data="@Countries"
                              ValueFieldName="@nameof(Country.Id)"
                              TextFieldName="@nameof(Country.CountryName)"
                              Width="250px">
    </DxDataGridComboBoxColumn>
    @*...*@
</DxDataGrid>

@code {
    IEnumerable<Order> Orders;
    IEnumerable<Country> Countries;

    protected override void OnInitialized() {
        Countries = CountryService.GetCountries();
        Orders = OrderService.GetOrders();
    }
}

Run Demo

See Also