0
votes

I'm new to asp.net or mvc Development, and i'm trying to convert a static html template to asp.net mvc

i have code in layout page for menu Items

  • class="active">@Html.ActionLink("Home","Index")
  • @Html.ActionLink("Destinations","Destinations")
  • @Html.ActionLink("Support","Support")
  • @Html.ActionLink("About US", "About_US")
  • @Html.ActionLink("Blog","Blog")
  • @Html.ActionLink("Contact Us","Contact_US")

in static website i can easily paste class="active" for the specific page to make the specific tab highlighted,as we have to repeat the same code for every static page but i don't know how to do this in MVC where we have only one layout for all actions.

1

1 Answers

0
votes

See below

@Html.ActionLink("linkText",
    "Action",
    "Controller",
    new { /*routing values, leave empty if nothing specific*/ }, 
    new { @class = "active" /*all html attributes (id, style, rel, etc) goes here*/ })