我使用bootstrap在MVC
上进行了以下导航,如何在不删除li
的情况下将存储菜单链接(第二个@ActionLink
)作为drowndown包含添加和查看链接?
<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>
答案 0 :(得分:16)
<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>