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

DxGridDataColumn.UnboundExpression Property

Specifies an expression to evaluate values for the unbound column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public string UnboundExpression { get; set; }

Property Value

Type Default Description
String null

The expression.

Remarks

Use the UnboundExpression property to specify an expression to evaluate values for the current unbound column. An expression can consist of field names, constants, operators, and functions. Field names should be wrapped in brackets.

Note

The UnboundExpression property specifies an expression according to our Criteria Language Syntax.

Unbound expression samples:

  • "[Quantity] * [UnitPrice] * (1 - [BonusAmount])"
  • "[FirstName] + ' ' + [LastName]"
  • "[Country] == 'USA'"
  • "[OrderDate] > #8/16/1994# AND [Quantity] > 20"
<DxGrid Data="@forecasts" >
    <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" />
    </Columns>
</DxGrid>

DevExpress Blazor Grid - Unbound Columns

To implement custom logic or obtain data from a custom/external data source handle the UnboundColumnData event.

View Example: Create and Edit Unbound Columns

Limitations

  • When you use a Server Mode data source, the Grid does not support unbound columns whose values are populated in the UnboundColumnData event handler. You can create unbound columns whose values are calculated based on the UnboundExpression.
  • When you use a GridDevExtremeDataSource, the Grid does not support unbound columns.

Export Unbound Expression as Formulas

When exporting an unbound column whose values are evaluated based on the UnboundExpression property, the Grid component exports cell values. Set the ExportUnboundExpressionAsFunction property to true to export these column values as formulas.

<DxGrid @ref="Grid" Data="@Data">
    <Columns>
        @* ... *@
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" ExportWidth="70"/>
        <DxGridDataColumn FieldName="Quantity" ExportWidth="70" />
        <DxGridDataColumn FieldName="Total" UnboundType="GridUnboundColumnType.Decimal" DisplayFormat="c" 
                          UnboundExpression="[UnitPrice] * [Quantity]" />
    </Columns>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
    // ...
    async Task ExportXlsx_Click() {
        await Grid.ExportToXlsxAsync("ExportResult", new GridXlExportOptions() {
            ExportUnboundExpressionAsFunction = true,
        });
    }
}

Implements

See Also