Back to Devexpress

System.ArgumentNullException: 'X' requires a value for the 'Expression' property

blazor-403285-troubleshooting-editor-related-issues-system-argument-null-exception-requires-a-value-for-the-expression-property.md

latest1.1 KB
Original Source

System.ArgumentNullException: 'X' requires a value for the 'Expression' property

  • Dec 07, 2021

If your EditForm contains an editor that does not use two-way binding, one of the following exceptions can occur:

DevExpress.Blazor.DxComboBox requires a value for the ‘ValueExpression’ property. It is specified automatically when you use two-way binding (‘bind-Value’).
OR
InvalidOperationException: A value for the ‘ValuesExpression’ and ‘TextExpression’ properties not found.

To fix the issue, do one of the following:

  • Specify the Expression property for the properties you use. For example, if you use the Value property and the ValueChanged event separately, also specify the ValueExpression property.
razor
<DxComboBox Data="@Strings"
    Value="@Value" 
    ValueChanged="@((string s) => ValueChanged())"
    ValueExpression="@(() => Value)">
</DxComboBox>
  • Implement the two-way binding in the EditForm.