Advertisement
Guest User

Dropdown

a guest
Nov 8th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.38 KB | None | 0 0
  1. Been toying around with this for a bit and have had quite a bit of success so far but there's just one problem I personally can't seem to fix.
  2.  
  3. I'm using bootstrap to create my navbar and everything in it which works fine for the most part, until I come to the point where I am using dropdowns.
  4.  
  5. What I want it to look like is something like [this](https://i.imgur.com/ulyBksM.png)
  6.  
  7. But the result I get is [this](https://i.imgur.com/o28zSD3.png)
  8.  
  9. @model MessePrototyp.Models.MenuItem
  10.  
  11. <li class="dropdown-submenu">
  12.  
  13.     <a href="#" class="dropdown-item dropdown-toggle" data-toggle="dropdown">@Model.Caption</a>
  14.  
  15.     <ul class="dropdown-menu">
  16.         @foreach (var subitem in @Model.MenuItems)
  17.         {
  18.             if (subitem.MenuItems.Count != 0)
  19.             {
  20.  
  21.                 @await Html.PartialAsync("MenuItem", @subitem)
  22.  
  23.             }
  24.             else
  25.             {
  26.                 <li><a a class="dropdown-item" asp-area="" asp-controller="@subitem.Controller" asp-route-id="@subitem.Notation" asp-action="@subitem.Action">@subitem.Caption</a></li>
  27.  
  28.  
  29.             }
  30.  
  31.  
  32.         }
  33.     </ul>
  34. </li>
  35.  
  36. This line here
  37.  
  38.     <a href="#" class="dropdown-item dropdown-toggle" data-toggle="dropdown">@Model.Caption</a>
  39.  
  40. seems to be the one creating the duplicate of the 'title', I have not yet found a way to fix this though since nobody else seemed to have this problem.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement