剃刀Html.ActionLink参数 [英] Razor Html.ActionLink Parameters
本文介绍了剃刀Html.ActionLink参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的code在我看来:
I have the following code in my view:
@Html.ActionLink(item.Title, "Articles/Details", New With {.id = item.ArticleId})
这会产生以下链接:
It produces the following link:
/博客/条/详细信息/ 1
/Blog/Article/Details/1
我希望它产生这一点,而不是:
I want it to produce this, instead:
/条/详细信息/ 1
/Article/Details/1
我试着用的参数搞乱,但我不知道如何使它做我想做的。我怎样才能做到这一点?谢谢你。
I tried messing with the parameters, but I'm not sure how to make it do what I want. How can I do this? Thanks.
推荐答案
使用此超载
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
Object routeValues,
Object htmlAttributes
)
所以你的code可以这样写
So your code can be written like
@Html.ActionLink(item.Title, "Details","Article",
New With {.id = item.ArticleId},Nothing)
检查<一href=\"http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx\">this MSDN页面看到所有可用的重载
这篇关于剃刀Html.ActionLink参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文