EditTemplate Dropdown System.ArgumentException Error

Hello,

I updated Radzen to the latest release and now I get this error below for the dropdown in datagrid inline editing.

RadzenDataGridColumn TItem="FINISH" Property="EXTVSL" Title="Ext Visual" TextAlign="TextAlign.Center" Width="35px">
EditTemplate Context="bpi">
RadzenDropDown TValue="string" AllowClear="false" @bind-Value="bpi.EXTVSL" ValueProperty="EXTVSL" Style="width:100x; display: block;"
Data=@DropDownValues TextProperty="EXTVSL">
/RadzenDropDown>
/EditTemplate>
/RadzenDataGridColumn>"

private IEnumerable DropDownValues = new string[] { "FMD", "REJ", "FEG" };

Any idea why I'm getting this error below in the ver 4... in inline editing?

System.ArgumentException: 'EXTVSL' is not a member of type 'System.String' (Parameter 'propertyOrFieldName')
at System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName)
at Radzen.PropertyAccess.Getter[TItem,TValue](String propertyName, Type type)
at Radzen.DropDownBase1.OnParametersSet() at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.DataBoundFormComponent1.SetParametersAsync(ParameterView parameters)
at Radzen.DropDownBase1.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenDropDown1.SetParametersAsync(ParameterView parameters)

You have set TextProperty and you shouldn't. You are setting the Data to array of strings and a string does not have a EXTVSL property. TextProperty should be set only if you set Data to a collection of objects and you need to display a property of that object.

Okay, I removed TextProperty from it. But I still get the same error.

It works on 4.1.10 but not on any after.

Thanks,

You should remove ValueProperty as well - a string does not have EXTVSL property :slight_smile: In earlier versions we used reflection and if we didn't find the property specified via ValueProperty or TextProperty returned ToString(). This was both slow and wrong.

1 Like

Perfect! It works now.

Thanks,