User-1917609967 posted
I'm am working on a blazor server-side webapplication which is basically about patients who can fill out several questionaires about their disease. This data is stored in a database via EF Core. My problem is that all questionaires feature a field, where
the user can specifiy several options, a multiselect, with the underlying data type being a [Flags] Enum:
[Flags]
public enum PainSite
{
BehindBothEyes = 1,
... // 12 options in total
}
When using <InputSelect> I was only able to specify ONE option, since it does not allow the attribute "multiple". Binding one enum option did work but I need the input to be a multiselect! (no matter if dropdown or listbox). Thus I tried the following,
which allows me to actually select multiple values but only one is actually bound and hence stored in the database.
<select multiple class="form-control" @bind="@PostOp.PainStart">
@foreach (var painSite in Enum.GetValues(typeof(PainSite)))
{
<option value="@painSite">@painSite</option>
}
</select>
Any idea?