Reputation: 359
I have a route map like:
routes.MapRoute(
name: "ConversationDetails",
url: "Conversations/{id}/Details",
defaults: new
{
controller = "Conversations",
action = "Details"
}
);
and I want to create an @Html.ActionLink
that will fit my path.
When I'm entering my link, I want to generate the id
that will follow the controller "Conversations
" name, and after that I want to add "Details
" as an action that I want to enter and pass the id
parameter. Is it possible ?
Upvotes: 1
Views: 766
Reputation: 50728
You can use URL.RouteURL to achieve what you are looking to do. See this: Using Url.RouteUrl() with Route Names in an Area
Taken from there and modified:
Url.RouteUrl("ConversationDetails", new { id = 5 })
Upvotes: 2