[英]send perameters to an action method from partialview
I have following PartialView and I want to call Product_Delete
method and send Product_ID
once I click that link 我已经关注了PartialView,我想调用
Product_Delete
方法并在单击该链接后发送Product_ID
@model IEnumerable<albaraka.Models.ProductTableViewModel>
<table class="table">
<tr>
<th>@Html.DisplayNameFor(model => model.Product_ID)</th>
...
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Product_ID)</td>
.....
<td>@Html.ActionLink("Delete", "Product_Delete","Home", new { idnumber = item.Product_ID })</td>
</tr>
}
</table>
I have following Action method 我有以下操作方法
public ActionResult Product_Delete(string idnumber)
{
..............
}
But once I send this idnumber
getting null in Action Method 但是一旦我发送了这个
idnumber
,在Action Method中就会为null
How can I bind correct value. 如何绑定正确的值。
Your rendering the idnumber
as a html attribute, not as a route value. 您将
idnumber
呈现为html属性,而不是路由值。 Change it to use this overload 更改它以使用此重载
@Html.ActionLink("Delete", "Product_Delete", "Home", new { idnumber = item.Product_ID }, null)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.