ASP.NET MVC 中 ActionLink 的等效图像 [英] Image equivalent of ActionLink in ASP.NET MVC
问题描述
在 ASP.NET MVC 中是否有等效于 Img 标签的 Html.ActionLink 助手?
In ASP.NET MVC is there an equivalent of the Html.ActionLink helper for Img tags?
我有一个输出动态生成的 JPEG 的控制器动作,我想使用相同的 Lambda 表达式来链接到它,就像我使用 ActionLink 做 HREF 一样.
I have a controller action that outputs a dynamically generated JPEG and I wanted to use the same Lambda expressions to link to it as I do HREFs using ActionLink.
或者,只提供路由 URL(再次使用 Lambda 指定)的帮助程序也是可以接受的.
Alternatively, a helper that just gives the URL to a route (again specified using Lambdas) would also be acceptable.
编辑:我最初指定我使用的是预览版 5,但是我发现测试版已经发布.所以总而言之,版本号是一个不需要的信息,因为我可能很快就会升级:-)
EDIT: I had originally specified that I was using Preview 5, however I see that a Beta has been released. So all-in-all the version number was an unneeded piece of info as I may be upgrading soon :-)
推荐答案
Url.Action() 将为您提供大多数 Html.ActionLink 重载的裸 URL,但我认为 URL-from-lambda 功能仅可用通过 Html.ActionLink 到目前为止.希望他们会在某个时候为 Url.Action 添加类似的重载.
Url.Action() will get you the bare URL for most overloads of Html.ActionLink, but I think that the URL-from-lambda functionality is only available through Html.ActionLink so far. Hopefully they'll add a similar overload to Url.Action at some point.
这篇关于ASP.NET MVC 中 ActionLink 的等效图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!