Can anybody tell me how to call a method on a different controller from within an action method? I don\'t want to redirect. I want to call a method on a different controller
I was looking for the same thing, but seriously people, why the need to write such complicated answers.
Here's a post that will answer it very simply: Using Html.ActionLink to call action on different controller
Basically you just have to use this overload of the actionlink:
ActionLink(HtmlHelper, String, String, String, Object, Object)
So you will have:
ActionLink("linkText", "actionName", "controllerName", routeValues, htmlAttributes)
If you don't have any routeValues (which are the Inputs for the Action) or htmlAttributes, you have to set them as null.
Here's an example call:
@Html.ActionLink("Add New Student", "Create", "Student", null, new { @class = "btn btn-primary" })