Hi,
This is happening because you have passed selectedIndexes.
In the OnChange you should change the selected indexes to match the current index.
Here is the fixed version:
<DropDownList @ref=”EWDeviceList” SelectedIndexes=”@selectedIndexes” OnChange=”ChangeDevice” DataSource=”@dataSource”/>
@code
{
DropDownList EWDeviceList = default!;
string[] dataSource = new string[] { “One”, “Two” };
int[] selectedIndexes = new int[] { 1 };
private async void ChangeDevice(Event chEv)
{
DropDownListChangeEventDetail detail = chEv[“Detail”];
selectedIndexes = new int[] { detail.Index };
string devNm = EWDeviceList.SelectedValues[0].ToString();
}
}
I hope this helps!
Best Regards,
Svetoslav Borislavov
Smart UI Team
https://www.htmlelements.com/