When I attempt to pass a value into a DropdownList it appears for a brief second then disappears and the value is overriden to null. This can be seen using the following code and the linked files:
@page "/test"
@using ThinBlueLieB.Helper.Extensions
@using Syncfusion.Blazor.DropDowns
<div class="w-25 container">
<SfDropDownList TItem="string" TValue="TimelineinfoEnums.RaceEnum?" PopupHeight="230px" Placeholder="Race" @bind-Value="@officer.Race" DataSource="@Races">
</SfDropDownList>
<h3>@officer.Race</h3>
</div>
@code{
public ViewOfficer officer { get; set; } = new ViewOfficer();
protected override void OnInitialized()
{
officer.Race = TimelineinfoEnums.RaceEnum.Native;
officer.Misconduct = new int[] { };
}
public IEnumerable<string> Races = EnumExtensions.GetEnumDisplayNames<TimelineinfoEnums.RaceEnum>();
}
If you run this, "Native" will appear briefly then disappear. I have attached EnumExtensions (which contains extension methods), TimelineinfoEnums(which contains RaceEnum), and ViewOfficer(which contains the ViewOfficer model); with them you should be able to replicate the issue. How do I data-bind to and from a DropDownList?
Attachment:
DropdownList_Data_Binding_Issue_362f4e3.zip