我有一个 html 选择器,我想在我的表单中为我的“model => model.type”使用选定的值。有没有办法将 my@Html.EditorFor(model => model.type)
中的值设置为选择器的值?
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Bet</legend>
<div class="editor-label">
@Html.LabelFor(model => model.type)
</div>
<div class="editor-field">
<select id ="type">
<option value="Football">Football</option>
<option value="Rugby">Rugby</option>
<option value="Horse Racing">Horse Racing</option>
</select>
@Html.EditorFor(model => model.type)
@Html.ValidationMessageFor(model => model.type)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>