Setting the value of a RadioButtonList to a Property in the Designer generates an error

I get the following error when binding the RadioButtonList to a property type of either dynamic or int? (nullable). The designer is not building the code in a way that will work. I need to be able to bind the list to a an int?.

|Error|CS1662|Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type

If I manually modify the razor like the online example shows, it works. I just can't get it to work with the designer and don't want to have to exclude the page to get it to work.

The designer creates this:

<RadzenRadioButtonList @bind-Value="@answerValue" Name="Answer" Change="@AnswerChange">
                  <Items>
                    <RadzenRadioButtonListItem Text="Yes" Value="0">
                    </RadzenRadioButtonListItem>
                    <RadzenRadioButtonListItem Text="No" Value="1">
                    </RadzenRadioButtonListItem>
                    <RadzenRadioButtonListItem Text="Not Applicable" Value="2">
                    </RadzenRadioButtonListItem>
                  </Items>
                </RadzenRadioButtonList>

But this is what is needed to work:

<RadzenRadioButtonList @bind-Value="@answerValue" TValue="int?" Name="Answer" Change="@((args) => AnswerChange(args))">
                  <Items>
                    <RadzenRadioButtonListItem Text="Yes" Value="0" TValue="int?">
                    </RadzenRadioButtonListItem>
                    <RadzenRadioButtonListItem Text="No" Value="1" TValue="int?">
                    </RadzenRadioButtonListItem>
                    <RadzenRadioButtonListItem Text="Not Applicable" Value="2" TValue="int?">
                    </RadzenRadioButtonListItem>
                  </Items>
                </RadzenRadioButtonList>

Hi @Crowmmark,

You are right. At the moment component cannot be configured from the designer to work with nullable values. We will do our best to provide fix early next week.

Possible workaround is to defined it using HTML component like this:


The handler should be in the partial class of the page

here is how it looks runtime

Nice. I'll give that a try. Thank Vladimir.

That worked perfectly. Thanks again Vladimir. I love this tool.