blazor-devexpress-dot-blazor-dot-dxgriddatacolumn-09c41de8.md
Specifies an expression to evaluate values for the unbound column.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[DefaultValue(null)]
[Parameter]
public string UnboundExpression { get; set; }
| Type | Default | Description |
|---|---|---|
| String | null |
The expression.
|
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>
To implement custom logic or obtain data from a custom/external data source handle the UnboundColumnData event.
View Example: Create and Edit Unbound Columns
UnboundExpression.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,
});
}
}
See Also