I am trying to bind a multiple select to a value which is then passed to a model, but currently it is only returning one value, I tried changing it from a string to a string array but got many errors and couldn't find a solution.
Does anyone know how I can return all the values the user has selected?
Thank You!
<div class="form-group col-md-6">
<label for="dur">Duration</label>
<select @bind="Duration" class="custom-select" id="dur" multiple>
<option value="12" selected>One Year</option>
<option value="24">Two Year</option>
<option value="36">Three Year</option>
<option value="48">Four year</option>
<option value="60">Five Year</option>
</select>
<small class="form-text text-muted">Hold <b>'CTRL'</b> to select multiple.</small>
</div>
@code {
private string _Duration;
private string Duration
{
get => _Duration;
set
{
if (value != _Duration)
{
_Duration = value;
UpdateModel();
}
}
}
}