我有以下代码但我的Sizes列表没有与controller绑定。任何帮助都会适用。
这是我的观点模型。
public class ProductIqlMeasurementListingViewModel
{
public ProductIqlMeasurementListingViewModel()
{
Sizes = new List<SizeValueViewModel>();
}
public int StyleIlqMeasurementId { get; set; }
public List<SizeValueViewModel> Sizes { get; set; }
public double Tolerance { get; set; }
public string MeasurementPointDescription { get; set; }
}
这是控制器。
public ActionResult EditMeasurement(int StyleIlqMeasurementId, List<SizeValueViewModel> Sizes)
{
return View();
}
这是我的观点。
@model List<Codezync.ProductionMonitoring.ViewModels.ProductIqlMeasurementListingViewModel>
<table class="table table-hover">
<tr>
<th></th>
<th>Measurement Points</th>
<th>Tolerance+/-</th>
@for (int i = 0; i < Model[0].Sizes.Count; i++)
{
<th>@Model[0].Sizes[i].Code</th>
}
</tr>
@for (int i = 0; i < Model.Count; i++)
{
<tr>
@Html.HiddenFor(x => x[i].StyleIlqMeasurementId)
@Html.HiddenFor(x => x[i].MeasurementPointDescription)
@Html.HiddenFor(x => x[i].Sizes)
<td>@Html.ActionLink("Edit", "EditMeasurement", "Style",new { StyleIlqMeasurementId = Model[i].StyleIlqMeasurementId, Sizes = Model[i].Sizes }, new { @class = "ui-btn-right" })</td>
<td>@Html.DisplayFor(x => x[i].MeasurementPointDescription)</td>
<td>@Html.DisplayFor(x => x[i].Tolerance)</td>
@for (int j = 0; j < Model[i].Sizes.Count; j++)
{
<td>@Html.DisplayFor(x => Model[i].Sizes[j].Value)</td>
@Html.HiddenFor(x => Model[i].Sizes[j].Value)
}
</tr>
}
</table>
如何将尺寸列表提供给我的控制器?任何帮助都可以实现