The selection of the DropDown doesn't change if SelectedType is changed. Atleast not after initial selection. Are there a right way to express this two-way binding?
So SelectedType is updated when the selection is changed and the selection is changed if SelectedType is changed programatically?
This topic mentions @bind-SelectedItem, is that still valid?
If I try:
<RadzenDropDown Data="@GetTypes()" TValue="string" @bind-SelectedItem="@SelectedType"/>
I get this compilation error:
error CS0266: Cannot implicitly convert type 'object' to 'string'
GetTypes returns List
and
SelectedType is a string
Pretty much all Radzen.Blazor input components support two-way binding via @bind-Value. You can check the DropDown demos for various working configurations.
If you believe you have discovered a problem please provide a code snippet which reproduces it. Otherwise my response remains the same - @bind-Value should be used. Make sure you have properly configured the dropdown as well. Right now we don't know what GetTypes() returns and what SelectedType is.
I notice I didn't write the full type information above (it was swallowed by the markup). GetTypes returns a List<string>
and
SelectedType is a string.
I will try to make a sample that demonstrates the problem. Or come back with my solution.
My question is more or less if I have missed something in my configuration of the DropDown.
I have now solved my problem.
The problem was that I did set SelectedType in GetTypes()
I thought that should work since it happened when the razor page invoked Gettypes, but now I have changed GetTypes to also call