少し難しいと思われることをしようとしています。私は ASP.NET や JQuery などの完全な初心者なので、アドバイスを求めてここにいます。
そのように表示される式を作成しました:
コードは次のようになります。
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>
Room
</th>
<th>
Room name
</th>
<th>
User
</th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model._listPerson.Count(); i++) {
<tr>
<td>
@Html.EditorFor(m => m._listPerson[i].myValue.isSelected)
</td>
<td>
@Html.DisplayFor(m => m._listPerson[i].myValue.name)
@Html.HiddenFor(m => m._listPerson[i].myValue.name)
@Html.HiddenFor(m => m._listPerson[i].myKey)
</td>
<td>
<!--Obtain the KeyValuePair<int, List<PersonModel>> that correspond to the index.-->
@Html.DropDownListFor(m => m.selectedPerson[i], new SelectList(Model._list[i].myValue, "id", "name"))
</td>
</tr>
}
</tbody>
</table>
<p>Assign all selected rooms to user @Html.DropDownListFor(m => m.useless, new SelectList(Model._list[0].myValue, "id", "name"))</p>
したがって、私がやりたいことの目的は、「割り当てられたユーザー」のすべてのフィールドを、テーブルの下部で選択されているユーザーの名前に更新することです。それを簡単に行う方法は?
ありがとう !