通过图标无效调用操作

时间:2014-05-31 20:00:13

标签: jquery css asp.net asp.net-mvc asp.net-mvc-4

我使用以下代码,当您单击图像时,我想调用编辑操作 目前我收到了错误

<a href="@Url.Action("  ", "Edit", new { id = item.UserId })"><img src="../../imges/pen.jpg"></a>

这是错误

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /Edit/ /f

当我使用下面的defult代码时,我该如何从图标中调用编辑操作?

@Html.ActionLink("Edit", "Edit", new { id = item.UserId }, new { @class = "btn btn-mini btn-info icon-edit bigger-120" }) |

1 个答案:

答案 0 :(得分:1)

试试这个:

<a href="@Url.Action("Edit", new { id = item.UserId })">
   <img src="../../imges/pen.jpg">
</a>

根据MSDN documentation@Url.Action()的第一个参数是actionName,其次是附加参数。