mileyH
mileyH

Reputation: 176

invoke action via icon not working

Im using the following code which I want to invoke the edit action when you click on the image currently i got error

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

This is the error

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

when I use the following defult code its works,how should I invoke the edit action from the icon?

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

Upvotes: 0

Views: 33

Answers (1)

Kevin Brechb&#252;hl
Kevin Brechb&#252;hl

Reputation: 4727

Try this:

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

According to the MSDN documentation the first parameter of @Url.Action() is the actionName, the second the additional parameters.

Upvotes: 1

Related Questions