我正在开发一个 ASP.NET MVC 应用程序,我需要将 TextBox 值从视图传递到控制器,这个 TextBox 在表中,我需要获取输入值。
@foreach (var item in Model)
{
<tr class="odd gradeX">
<td>
@Html.DisplayFor(modelItem => item.Product.ProductName)
</td>
<td>
@Html.DisplayFor(modelItem => item.User.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Product.Reference)
</td>
<td>
@Html.TextBoxFor(modelItem => item.QuantityWanted, new { style = "width:60%", type = "number", min = "0", step = "1", max = item.Quantity })
@Html.ActionLink("Add", "Add", new { idProduct = item.ProductID, idUser = item.UserID, quantityWanted= item.QuantityWanted })
</td>
</tr>
}
我使用了 javascript 和 jquery,但我没有得到任何东西,并且 quantityWanted 总是返回 null 或 0 值。