1
<li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="collapse" aria-haspopup="true" aria-expanded="false"> Manage </a> <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" asp-controller="Administration" asp-action="ListUsers"> Users</a> <a class="dropdown-item" asp-controller="Administration" asp-action="ListRoles"> Roles</a> </div> </li> 

I tried on Opera, Chrome, Brave, Explorer...

  • You've tagged this question with Blazor. Please can you post the C# logic you have for this control, into your question? For people to be able to answer your question, they need a minimum reproducible example of the problem. – Kieran Devlin Nov 23 '21 at 12:42
  • I am sorry for that, not blazer my mistake, logic is very simple [HttpGet] public IActionResult ListUsers() { var users = userManager.Users; return View(users); } – Радостин Атанасов Nov 23 '21 at 20:31

2 Answers2

0

Why not use the MVC strongly type helper methods? Do something like this:

@Html.DropDownListFor(m => m.StudentGender, 
            new SelectList(Enum.GetValues(typeof(Gender))), 
            "Select Gender")
Merna Mustafa
  • 1,235
  • 2
  • 10
  • 22
John Obasi
  • 21
  • 3
0

Firstly, please be sure you use Bootstrap version 4.x.

Then change data-toggle="collapse" to data-toggle="dropdown" like below:

<li class="nav-item dropdown"> 
    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Manage </a> 
    <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> 
        <a class="dropdown-item" asp-controller="Administration" asp-action="ListUsers"> Users</a> 
        <a class="dropdown-item" asp-controller="Administration" asp-action="ListRoles"> Roles</a> 
    </div> 
</li>

Result:

enter image description here

Rena
  • 30,832
  • 6
  • 37
  • 72