我如何在MVC3的ActionLink的包裹的图像? [英] How do I wrap an image in an ActionLink in MVC3?
本文介绍了我如何在MVC3的ActionLink的包裹的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有需要的地方,当用户点击它在ActionLink的包装图像,以局部视图,它会和编辑图像。我有一个内容处理器称为img.ashx。
I have a partial view where need to wrap an image in an ActionLink so when the user clicks on it, it will go and edit the image. I have a content handler called img.ashx.
下面是我的形象的文字:
Here is my image text:
下面是我的ActionLink:
@ Html.ActionLink(item.Title,EditMediaItem,新的{位置= item.Location,ID = item.Id})
Here is my ActionLink: @Html.ActionLink(item.Title, "EditMediaItem", new { location = item.Location, id = item.Id })
如何才能做到这一点?
先谢谢了。
推荐答案
使用URL helper方法Url.Action,例如:
Use the Url helper method Url.Action, example:
<a href="@Url.Action(item.Title, "EditMediaItem", new { location = item.Location, id = item.Id })"><img src="#" /></a>
这篇关于我如何在MVC3的ActionLink的包裹的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文