Reputation: 21430
I have the following code in my view:
@Html.ActionLink(item.Title, "Articles/Details", New With {.id = item.ArticleId})
It produces the following link:
/Blog/Article/Details/1
I want it to produce this, instead:
/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.
Upvotes: 4
Views: 24642
Reputation: 218732
Use this overload
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
Object routeValues,
Object htmlAttributes
)
So your code can be written like
@Html.ActionLink(item.Title, "Details","Article",
New With {.id = item.ArticleId},Nothing)
Check this msdn page to see all available overloads
Upvotes: 6