如何在动作链接中插入控制器名称而不添加其他内容?

时间:2013-05-30 16:39:22

标签: asp.net-mvc html-helper actionlink

这是我的行动链接:

@Html.Raw(HttpUtility.UrlDecode(Html.ActionLink("Comment", "Comment", new { id = item.NewsId, title = item.Title + "#disqus_thread"}).ToString()))

我想为它添加控制器名称,但是当我尝试使用之前我需要添加一个routevalue ..我不想这样做。

赞赏任何类型的解决方案或帮助

1 个答案:

答案 0 :(得分:0)

这次超载怎么样?

public static MvcHtmlString ActionLink(
    this HtmlHelper htmlHelper,
    string linkText,
    string actionName,
    string controllerName,
    Object routeValues,
    Object htmlAttributes
)

ActionLink代码: -

Html.ActionLink("Comment", "Comment", "MyController",new { id = item.NewsId, title = item.Title + "#disqus_thread"},null)
相关问题