I use Visual Studio Enterprise 2015. I started a new "ASP.NET Web Application" project and from "ASP.NET 4.6 Templates" I chose "MVC" (MVC4).

In my Index.cshtml View I added the following "divs" in order to create a navigation menu for my web application:

<div class="NavigationItem" onclick="@{Html.ActionLink("HOME", "Index", "home");}">
   HOME
</div>
<div class="NavigationItem" onclick="@{Html.ActionLink("ABOUT", "About", "Home");}">
   ABOUT
</div>
<div class="NavigationItem" onclick="@{Html.ActionLink("CONTACT", "Contact", "Home");}">
   CONTACT
</div>

The CSS class "NavigationItem" which I use has the following code:

.NavigationItem{
    font-size: 13.5pt;
    color: #3A3A3A;
    font-family: Arial;
    margin: 33px 10px 4px 10px;
}

.NavigationItem:hover {
    color: #CC0000;
    border-bottom: 4px #CDCDCD solid;
}


[![Mouse_Hover][1]][1]

The code is executed, but the "onClick" event of the div does not fire when I click on a div. Consequently, the "ActionLink" is never executed. The question is: how can I invoke the execution of the "ActionLink" if the div is clicked?

In case you know how could such think be implemented, or if you have an idea, please let me know. It is going to be a great help to me.

Thank you in advanced.

Related posts

Recent Viewed