【发布时间】:2018-01-20 15:01:53
【问题描述】:
我正在用 asp.net MVC 构建一个 Web 应用程序。我的引导导航栏昨天工作得很好。当我在调试中运行时,没有错误。布局上没有更改任何代码。我最近尝试对 bootstrap repo 做一个 href ,但没有成功。我不是要你调试我的代码,因为它们不应该是任何错误。为什么会发生这种情况?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Employee Portal</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<!--================== NAVBAR ===================-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Employee Portal", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Add Employee", "Create", "Employees")</li>
<li>@Html.ActionLink("All Employees", "Index", "Employees")</li>
<li>@Html.ActionLink("All Positions", "Index", "Positions")</li>
<li>@Html.ActionLink("All Departments", "Index", "Departments")</li>
<li>@Html.ActionLink("Reports", "Reports", "Home")</li>
<li>@Html.ActionLink("Employee Activity", "Index", "ChangeLogs")</li>
</ul>
</div>
</div>
</div> <!-- End NAVBAR-->
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Conservice</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
<script src="~/Scripts/bootstrap.js"></script>
</body>
</html>
【问题讨论】:
-
~/bundles/bootstrap捆绑包中有什么?如果您还直接链接到 bootstrap.js 文件,为什么还需要它?当你说“它不起作用”时,请具体说明,到底发生了什么? -
您是否在 Nuget 中不小心升级到了 Bootstrap 4?
-
我只直接链接到 bootstrap.js 文件,以防对包含所有引导文件的引导包的引用无法正常工作。 @IrishChieftain 这很有可能;你有推荐的修复方法吗?
-
检查项目中当前的版本。如果发生这种情况,您可以在 Nuget UI 中轻松恢复到 3.x。
-
@IrishChieftain 确实是 4.0 版。恢复到3.7,仍然查看相同。我怎么知道哪个版本适用于我原来的导航栏?
标签: asp.net razor model-view-controller bootstrapping