Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Drop down navigation in MVC

I have the following navigation on MVC using bootstrap, how can I make the Storage Menu Link (second li ) as a drowndown to include Add and View Links without removing the @ActionLink?

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="brand" href="/Home/Home">News Library</a>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li class="@ActiveLink("Home", "Home", null)">@Html.ActionLink("Home", "Home", "Home")</li>
                    <li class="@ActiveLink("About", "Home", null)">@Html.ActionLink("Storage", "Add", "Storage")</li>
                    <li class="@ActiveLink("Contact", "Home", null)">@Html.ActionLink("Activites", "Add", "Activites")</li>
                    <li class="@ActiveLink("Contact", "Home", null)">@Html.ActionLink("Search", "Index", "Search")</li>
                </ul>
                <ul class="nav pull-right">
                    <li>@Html.ActionLink("[Log Out]", "Logout", "Home")</li>
                </ul>                
            </div>
        </div>
    </div>
</div>
like image 507
rikket Avatar asked Apr 29 '14 11:04

rikket


1 Answers

<li class="@ActiveLink("Home", "Home", null) dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        Storage
        <span class="caret"></span>
    </a>
    <ul class="dropdown-menu" role="menu">
        <li>@Html.ActionLink("Storage", "Add", "Storage")</li>
        <li>@Html.ActionLink("Storage", "View", "Storage")</li>
    </ul>
</li>

See the bootstrap site for more information

like image 166
Electric Sheep Avatar answered Oct 14 '22 19:10

Electric Sheep