Binding RadzenRadioButtonList to string attribute

This is what I try to achieve:

<RadzenRadioButtonList @bind-Value="@model.Color" TValue="string">
    <Items>
        <RadzenRadioButtonListItem Text="Green" Value="Green" TValue="string" />
        <RadzenRadioButtonListItem Text="Yellow" Value="Yellow" TValue="string" />
    </Items>
</RadzenRadioButtonList>

Unfortunately, Visual Studio marks the Value attribute as errorneous and I get the error message:

"The name Green does not exist in the current context"
"The name Yellow does not exist in the current context"

What's the problem here?

This seems to be a limitation of the Blazor parser - it looks for a page property called Green instead of the string "Green". Probably it is confused by the fact that the Value property is generic. This should work as a workaround:

<RadzenRadioButtonListItem Text="Green" Value=@("Green") TValue="string" />
        
1 Like