【发布时间】:2019-12-21 20:31:48
【问题描述】:
首先,大家好。我是.net mvc 的新手。我有一个列表页面。列出了学生。到目前为止,一切都很好。这里需要输入学生的成绩,并且必须同时保存所有成绩。但是,由于模型以列表形式保存,因此我无法调出将保存数据的区域。
例如:
@ Html.EditorFor (model => model.note, new {htmlAttributes = new {@class = "form-control"}})
我在这里说model1的时候,我不能带来音符的质量。
所以我不能发帖。我的 html 部分有问题。
我的html代码:
@model IEnumerable<OnlineBasvuru.Entity.ViewModel.Exam>
@{
Layout = null;
}
<div>
@using (Html.BeginForm("ExamSave", "Exam", FormMethod.Post, new { @id = "examID" }))
{
<table class="table">
<thead>
<tr>
<th>
ChildrenID
</th>
<th>
Note
</th>
</tr>
</thead>
<tbody>
@for (int i=0; i<Model.Count(); i++)
{
<tr>
<td>
@Html.LabelFor(a=>a.childrenID[i])
</td>
<td>
@ Html.EditorFor (model => model.note, new
{htmlAttributes = new {@class = "form-control"}})
</td>
</tr>
}
</tbody>
</table>
<button type="submit">Save</button>
}
</div>
【问题讨论】:
标签: html .net forms post model-view-controller