I use Blazor serverside and I have this:
<InputSelect class="form-control" id="sYear" @bind-Value="@SelectedYear">
<option value="" selected="@(SelectedYear == "")">Year</option>
@foreach (int i in Enumerable.Range(admin.GetYearOfGregorianDate(DateTime.Now) - 20, 21).Reverse())
{
<option value="@i" selected="@(SelectedYear == i.ToString())">@i.ToString()</option>
}
</InputSelect>
As is seen, the value for the first option is empty and I expect when I choose the first option the bound value become empty string Not the string "Year" but the SelectedYear is set to "Year"! What to do to solve this?