我必须将复选框值和文本框值绑定到model.Here我正在使用模型来检索和发布数据。 我试过几个选项,但它没有奏效。将复选框和文本框绑定到视图模型
下面是我的代码:
@model IEnumerable<ALDS.Web.Areas.AR.Models.ReportViewModel>
@{
ViewBag.Title = "Standings";
}
<table class="table table-bordered">
<thead>
<tr>
<th>LR Date</th>
<th>LR Line No</th>
<th>Issue</th>
<th>Correction Response</th>
<th>Remarks</th>
<th>Submission</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@item.InsertDate
</td>
<td>
@item.LRLineID <a href="">View</a>
</td>
<td>Margin % incorrect</td>
<td><label for="cbox1">Corrected</label> <input type="checkbox" name="Corrected" value="@item.Status" /> <label for="cbox1">Neglected</label> <input type="checkbox" name="Neglected" value="@item.Status"/></td>
<td><input type="text" value="@item.Comments"/></td>
<td><a href="@Url.Action("Update","Error",Model)">Submit</a></td>
</tr>
}
</tbody>
</table>
我要送的复选框,文本框的值到控制器。 请帮忙。
不要忘记告诉OP把他的模型ID放在'.hidden()' –
它没有用。 :| – user3206357
你没有把表格标签“使用表格...”? – TTCG