jquery - 通过图标调用操作不起作用

标签 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

当我使用以下默认代码时,我应该如何从图标调用编辑操作?

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

最佳答案

试试这个:

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

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

关于jquery - 通过图标调用操作不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23974159/

相关文章:

javascript - jQuery:如何将 "src"属性写入子元素的 Onclick 函数参数

jquery - Jq mouseleave 删除背景悬停,防止正常的 css 悬停

javascript - 在 javascript 中 for 循环在 get 方法执行之前执行

javascript - 将 json 数据存储在代理模式内的变量中

html - 使用哪个 <div class ="name"> 或 <div id ="name">?

html - 使用边距居中 div

asp.net - 在 App_Code 类中强制转换 ascx

c# - 如何将数据(实体)从一个数据库传输到另一个数据库

c# - 在 asp.net 中创建 Excel 工作簿

jquery - Laravel 5.3 Ajax 登录