I am new to MVC and not sure what is going wrong here, but I feel it has something to do with popper.js and bootstrap. Everything looks good when I debug it, except the dropdown menu actually does not work.
I assume I am not loading the scripts properly, but I believe I am getting tripped up by the fact that NuGet does not have the most up to date version of popper.js for some reason, so I downloaded the file using the cdn reference, but there must be a way to link to the most up to date script.
This is a layout page if that has any impact.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
</head>
<body>
<nav >
<div >
<a href="#">App</a>
<button type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span ></span>
</button>
<div id="navbarSupportedContent" style="">
<ul >
<li >
<a href="~/Home">
Home
<span >(current)</span>
</a>
</li>
<li >
<a href="#">Features</a>
</li>
<li >
<a href="#">Pricing</a>
</li>
<li >
<a href="~/Home/About">About</a>
</li>
<li >
<a href="#" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</a>
<div >
<a href="#">Action</a>
<a href="#">Another action</a>
<a href="#">Something else here</a>
<div ></div>
<a href="#">Separated link</a>
</div>
</li>
</ul>
<form >
<input type="search" placeholder="Search">
<button type="submit">Search</button>
</form>
</div>
</div>
</nav>
<div >
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - App</p>
</footer>
</div>
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required:=False)
</body>
</html>
CodePudding user response:
The answer to my issue was the following:
https://stackoverflow.com/a/68712782/11133139
The default ASP.NET MVC template is out of date, to say the least.