Reputation: 85
I have the following action link in my view
@Html.ActionLink("Our menu", "Index", "Menu", null)
As far as I understand it, it is supposed to point at the action Index
from the controller Menu
. However it does not see the MenuController
which looks like:
namespace PizzeriaV2.Controllers
{
public class MenuController : Controller
{
// GET: Menu
public ActionResult Index()
{
DoSomething();
}
}
}
Instead of pointing at that action, the above mentioned link tries to look for Index
in MainController
- quite obviously not finding it there.
My questions are: Why is it happening? How can I make the link point at the right place?
Upvotes: 0
Views: 1375
Reputation: 58
Use This Following Code :
@Html.ActionLink("Title","Index","Menu",null,null)
Or:
@Html.ActionLink("Title","Index","Menu")
Upvotes: 3