finn green
finn green

Reputation: 307

Html.Action is not creating link to View

I'm trying to get a navigation bar going for my website but I am having some trouble.

I have the following:

<li>@Html.Action( "Project Management", "ProjectManagement", "Services" )</li>

Set up to call the view, but what it seems to be doing is placing that view into the navigation bar.

Is this the proper way to link the view to the navigation bar or should I try something different?

Upvotes: 3

Views: 94

Answers (1)

Jesse
Jesse

Reputation: 8759

What you want to use is @Html.ActionLink rather than @Html.Action.

  • @Html.ActionLink Generates a hyperlink, <a href="...">Text</a>
  • @Html.Action Executes a Controller action, i.e., returns the HTML/markup/JSON/whatever, that it's programmed to return.

Try this code instead:

<li>@Html.ActionLink( "Project Management", "ProjectManagement", "Services" )</li>

Upvotes: 1

Related Questions