-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
Milestone
Description
I tried to display a default empty optin in a select so I used;
<InputSelect @bind-Value="@TicketCreateDto.Type">
<option selected disabled hidden>Type de demande</option>
@foreach (var item in (TicketType[])Enum.GetValues(typeof(TicketType)))
{
<option value="@((int)item)"> @Enumerations.TicketType[(int)item]</option>
}
</InputSelect>
Wich isn't working,
I can do it without InputSelect:
<select name="Type">
<option selected disabled hidden>Type de demande</option>
@foreach (var item in (TicketType[])Enum.GetValues(typeof(TicketType)))
{
<option value="@((int)item)"> @Enumerations.TicketType[(int)item]</option>
}
</select>
But in this case I loose the benfit of model validation
Is there a way to define a default option selected with an empty value ?
Thanks.