After upgrading to blazor 17.4.39 DropDownList TValue int is giving following error.
DropDownList value is:@DropVal
EjsDropDownList Placeholder="e.g. Australia" TItem="Countries" TValue="int" Value="@DropVal" DataSource="@Country"
DropDownListEvents TValue="int" ValueChange="onChange"
DropDownListFieldSettings Value="Code"
/EjsDropDownList
@code {
public int DropVal = 0;
public class Countries
{
public string Name { get; set; }
public int Code { get; set; }
}
List Country = new List
{
new Countries() { Name = "Australia", Code = 1 },
new Countries() { Name = "Bermuda", Code = 2 },
new Countries() { Name = "Canada", Code = 3 },
new Countries() { Name = "Cameroon", Code = 4 },
};
private void onChange(Syncfusion.EJ2.Blazor.DropDowns.ChangeEventArgs args)
{
DropVal = args.Value;
StateHasChanged();
}
}
blazor.server.js:15 [2019-12-21T06:09:13.615Z] Error: System.InvalidCastException: Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType)
at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType, Boolean isClientChange)
at Syncfusion.EJ2.Blazor.DropDowns.EjsDropDownList`2.getItemData()
at Syncfusion.EJ2.Blazor.DropDowns.EjsDropDownList`2.setValue()
at Syncfusion.EJ2.Blazor.DropDowns.EjsDropDownList`2.updateValues()
at Syncfusion.EJ2.Blazor.DropDowns.EjsDropDownList`2.initValue()
at Syncfusion.EJ2.Blazor.DropDowns.EjsDropDownList`2.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)