Subby
Subby

Reputation: 5480

ASP.NET MVC direct user to a View from a different controller

I am using ASp.NET MVC 3.

Whilst in a View, how do I redirect the User to a View that's in a different Controller altogether?

I can do: @Html.ActionLink("Go Here", "Index") but I want to direct the user to an Index view of a different Controller.

Any help is highly appreciated.

Upvotes: 1

Views: 217

Answers (2)

Ammar
Ammar

Reputation: 1068

@Html.ActionLink(string LinkText, string ActionName, String ControllerName)

There are a lot of prameters to choose from. Type @HTML.ActionLink( and they will show up. Navigate between them using the up and down button.

Upvotes: 1

Raphaël Althaus
Raphaël Althaus

Reputation: 60493

use another overload from ActionLink

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

http://msdn.microsoft.com/en-us/library/dd505070%28v=vs.108%29

usage

@Html.ActionLink("Go Here", "Index", "<YourOtherController>")

Upvotes: 1

Related Questions