From a View in a different Controller I am trying to re-route to the "ClnVwDet" Action in my Client Controller with this @Html.ActionLink.
@Html.ActionLink("Client View", "ClnVwDet", "Client")
ClientController.cs
public ActionResult ClnVwDet()
{
int id = (int)TempData["id"];
bool vw = true; int pn = 0;
return RedirectToAction("Details", new { id, pn, vw });
}
No matter what actionName I use it always goes to the Client "Index" Action rather than the one I specify.
This corrected syntax for the ActionLink works.
@Html.ActionLink("Client View", "ClnVwDet", "Client", new { id = @Model.Id }, null)
Found answer here: Using Html.ActionLink to call action on different controller. See Banfords comment on cagdas's answer. To get the correct overload you need to add a fifth argument. If you want to pass routeValues with the (linkText, actionName, controllerName) overload you have to add the htmlAttribues to get the correct overload. (linkText, actionName, controllerName, routeValues, htmlAttribues)