JMK
JMK

Reputation: 28059

Cannot Resolve Action, even though my action exists

Hopefully a really simple MVC problem (), I have a controller in my Controllers folder called HomeController which contains a method called Index which looks like this:

public ActionResult Index()
{
    return View();
}

My Index view does indeed exist, and on my shared Layout view I have the following link (to my index page)

@Html.ActionLink("Home", "Index")

Am I doing this right? I have a method called Index in my controller which returns my Index view, so shouldn't this ActionLink work?

Upvotes: 0

Views: 5015

Answers (1)

devdigital
devdigital

Reputation: 34349

ActionLink takes the action name and then the controller name.

@Html.ActionLink("My Link", "Index", "Home");

See http://msdn.microsoft.com/en-us/library/dd505070(v=vs.108).aspx

Upvotes: 3

Related Questions