我需要上瘾,一个领域又一个领域。
选择框具有选项列表
如果是第一个或例如在下拉框中选择5个选项,类别:selectboxlist
然后我想在第二列类中设置值'-1':days_tpu
我能做的是在帖子的底部
查看:
<table>
<tr>
<td id="td01" class="@userColor1">@Html.DropDownListFor(m => m.Model1[nr_rows].PrzyczynaNieobecnosci, new SelectList(Enum.GetValues(typeof(Urlopy))), " ", new { @class = "selectboxlist" })</td>
<td id="td01">@Html.TextBoxFor(m => m.Model1[nr_rows].DniOdpracowania, new { @class = "days_tpu", @readonly = true })</td>
</tr>
</table>
答案 0 :(得分:0)
如果我正确地抓住了它,我会像这样解决您的问题:<select asp-for="PrzyczynaNieobecnosci" asp-items="@Html.GetEnumSelectList<Urlopy>()" id="selectList"></select>
。
这样,您就可以在html中看到带有值的下拉选择列表。
和javascript代码:
document.getElementById("selectList").addEventListener("change", setSecondColumnValue);
function setSecondColumnValue() {
var secondColumnField = document.getElementById('selectedValue');
if(this.value == "1")
secondColumnField.innerHTML = 1;
else
secondColumnField.innerHTML = 0;
}