Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created December 3, 2019 20:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavilanch/d9fdf5dbb17467b36f88a1273611c1ca to your computer and use it in GitHub Desktop.
Save gavilanch/d9fdf5dbb17467b36f88a1273611c1ca to your computer and use it in GitHub Desktop.
<div class="form-group">
<label>State:</label>
<div>
<InputSelectNumber class="form-control"
@bind-Value="Person.StateId"
>
<option value="0">--Select a state--</option>
@foreach (var item in States)
{
@if (item.Id == Person.StateId)
{
<option selected value="@item.Id">@item.Name</option>
}
else
{
<option value="@item.Id">@item.Name</option>
}
}
</InputSelectNumber>
<ValidationMessage For="@(() => Person.StateId)" />
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment