radzen-blazor
radzen-blazor copied to clipboard
RadzenDropDown unexpected item change on reload page
Today (with version 7.1.1) I faced an issue which seems to be present already several time (also verified in 5.9.7).
A RadzenDropDown gets unexpected call of SelectedItemChanged or Change event when page gets reloaded manually by pressing function key F5. But, this problem only apears when the drop down was opened.
Sample code in your razor page:
List<string> stringList = ["Option1", "Option2", "Option3"];
string selectedItem = stringList[1];
<RadzenDropDown
Data="@stringList"
@bind-Value="@selectedItem"
SelectedItemChanged="o => Console.WriteLine(o)"/>
To Reproduce
- Load the page -
Option2is selected, no Console output visible -> ok - Reload the page -
Option2is selected, no Console output visible -> ok - Select
Option3-Option3is selected,Option3is written to Console output -> ok - Reload the page -
Option1is visible as selected very shortly before page gets reloaded,Option1is written to Console output -> not ok (Option2gets selected as expected) - Reload the page -
Option2is selected, no Console output visible -> ok - Just open the DropDown and reload the page -
Option1is visible as selected very shortly before page gets reloaded,Option1is written to Console output -> not ok (Option2gets selected as expected) - Reload the page -
Option2is selected, no Console output visible -> ok
Expected behavior
Option1 must not get selected item if not selected explicitly by the user.
Screenshots N/A
Desktop (please complete the following information):
- OS: Windows 11
- Browser: Tested with Vivalidi (7.4.3684.55) and Chrome (137.0.7151.104)