MVC 如何获取list界面的值
下面是一个list列表,在列表中最后一列的数字是可以编辑的,我想点提交把修改后的模型数据在后台保存
@model WebApplication4.Models.BomMapping
@using GridMvc.Html;
@{
ViewBag.Title = "List";
}
<h2>List</h2>
<div class="ibox float-e-margins">
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
<div class="ibox-content">
<table class="table">
<tr>
@foreach (var c in Model.IrregularTitle)
{
<th>
@Html.DisplayFor(modelItem => c)
</th>
}
<th>
制式
</th>
<th>
脚数
</th>
<th></th>
</tr>
@foreach (var item in Model.Irregular)
{
<tr>
@if (Model.IrregularTitle.Count > 0)
{
<td>
@Html.DisplayFor(modelItem => item.Value1)
</td>
}
@if (Model.IrregularTitle.Count > 1)
{
<td>
@Html.DisplayFor(modelItem => item.Value2)
</td>
}
@if (Model.IrregularTitle.Count > 2)
{
<td>
@Html.DisplayFor(modelItem => item.Value3)
</td>
}
@if (Model.IrregularTitle.Count > 3)
{
<td>
@Html.DisplayFor(modelItem => item.Value4)
</td>
}
@if (Model.IrregularTitle.Count > 4)
{
<td>
@Html.DisplayFor(modelItem => item.Value5)
</td>
}
@if (Model.IrregularTitle.Count > 5)
{
<td>
@Html.DisplayFor(modelItem => item.Value6)
</td>
}
<td>
@Html.DisplayFor(modelItem => item.ProcessText)
</td>
<td>
@Html.TextBox("PinNumber", item.PinNumber, new { htmlAttributes = new { @class = "form-control" } });
</td>
</tr>
}
</table>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.RowsCount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="checkbox">
@Html.EditorFor(model => model.RowsCount)
@Html.ValidationMessageFor(model => model.RowsCount, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.ColumnCount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="checkbox">
@Html.EditorFor(model => model.ColumnCount)
@Html.ValidationMessageFor(model => model.ColumnCount, "", new { @class = "text-danger" })
</div>
</div>
</div>
<p>
<input type="submit" value="提交" />
@*// @Html.ActionLink("下一步", "List", Model)*@
</p>