0

I want to filter the options based on the constants. But it keeps showing the full list of the constants.

I have tried coded this way:

<EnumRadioGroup
    TEnum="@ConceptConstants.MaritalStatus"
    @bind-Value="@context.Status"
    Options="GetFilteredMaritalStatusOptions">
</EnumRadioGroup>
protected IEnumerable<MaritalStatus> GetFilteredMaritalStatusOptions()
{
    return Enum
        .GetValues(typeof(MaritalStatus))
        .Cast<MaritalStatus>()
        .Where(status => status == MaritalStatus.Married || status == MaritalStatus.Single);
}

but is show me this error ->:

Cant convert from "method group" to oneof.oneof <string[], antdesign radio option <Constance.ConceptConatst.MartialStatus>

MrC aka Shaun Curtis
  • 19,075
  • 3
  • 13
  • 31
iamme
  • 11
  • 3
  • `EnumRadioGroup` is not a standard Blazor control. – Dai Apr 18 '23 at 01:07
  • ahh yea im using ant-design-blazor component. may i know if you know how to filter the option out? – iamme Apr 18 '23 at 01:09
  • From what I can tell, `Options` needs to be an `IEnumerable>`: https://github.com/ant-design-blazor/ant-design-blazor/blob/master/components/radio/EnumRadioGroup.cs – Dai Apr 18 '23 at 01:12
  • ermm.. somehow not working thanks btw! – iamme Apr 18 '23 at 01:26

0 Answers0