我已经使用 ASP.NET MVC 在其中一个视图中编写了此代码。MVC 将复选框值返回给我(只有那些被选中)并使用文本框返回所有值(0、1、2 等)。我如何关联哪个文本框值属于哪个复选框(因为只有我得到选中的复选框值)
For Each item As InternalMailCalendarViewModel In ViewData("InternalMailCalendar")
End Code
<div class="editor-field">
@Html.CheckBox("InternalMailCalendarID", New With {.value = item.ID})
<label for="@item.ID">@item.Days</label>
</div>
<div class="editor-field">
<input type="text" id="RunsPerDay" name="RunsPerDay" placeholder="Runs Per Day" />
@Html.ValidationMessageFor(Function(model) model.RunsPerDay)
</div>
@*
<div class="editor-field">
<input type="checkbox" id="InternalMailCalendarID" name="InternalMailCalendarID" value="@item.ID" />
<label for="@item.ID">@item.Days</label>
</div>
<div class="editor-field">
<input type="text" id="RunsPerDay" name="RunsPerDay" placeholder="Runs Per Day" />
@Html.ValidationMessageFor(Function(model) model.RunsPerDay)
</div>
*@
@Code
Next
End Code