use*_*388 4 vb.net asp.net-mvc razor asp.net-mvc-3
我在视图中有以下代码:
@Html.ActionLink(item.Title, "Articles/Details", New With {.id = item.ArticleId})
Run Code Online (Sandbox Code Playgroud)
它产生以下链接:
/博客/条/详细信息/ 1
我想让它产生这个,而不是:
/条/详细信息/ 1
我试着弄乱参数,但我不知道如何让它做我想做的事.我怎样才能做到这一点?谢谢.
使用此重载
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
Object routeValues,
Object htmlAttributes
)
Run Code Online (Sandbox Code Playgroud)
所以你的代码可以像
@Html.ActionLink(item.Title, "Details","Article",
New With {.id = item.ArticleId},Nothing)
Run Code Online (Sandbox Code Playgroud)
检查此msdn页面以查看所有可用的重载
归档时间: |
|
查看次数: |
24240 次 |
最近记录: |