I开发者_如何学C want to get the URL of a route using the same syntax as Html.ActionLink
, but don't know how to do that from my View.
Is there an HtmlHelper extension that works like ActionLink
but returns only the URL?
For instance, I want to write:
<img src="<%= Html.ActionUrl("Image", new { id = 42 }) %>" />
Check out:
Url.Action()
Aka:
<img src="<%= Url.Action("Image", new { id = 42 }) %>" />
精彩评论