【发布时间】:2017-07-19 06:17:54
【问题描述】:
如何将引导程序添加到 asp.net mvc 4? 我已经通过 nudget bootstrap 安装,并且我还在 Bundle.config 中包含以下内容:
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-{version}.js"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css"));
我也加入了
"~/Scripts/bootstrap.js",
"~/Scripts/bootstrap.min.js"
我还在 Shared _layout 中包含了以下内容
@Styles.Render("~/Content/themes/base/css")
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/knockout")
@Scripts.Render("~/bundles/otf")
@Scripts.Render("~/bundles/knockout")
@RenderSection("scripts", required: false)
问题是如何在 Views/Home/index 中制作我的表格,例如引导页面的表格。我确实包含了
<table class="table">
<thead class="thead-inverse">
但它不起作用
【问题讨论】:
-
你在哪里包含了“~/Scripts/bootstrap.js”、“~/Scripts/bootstrap.min.js”脚本?您必须在 jquery 脚本之后呈现此脚本。而且您不需要两个引导脚本。仅包含 bootstrap.js 或 bootstrap.min.js
-
把
<link href="@Url.Content("~/Content/Bootstrap.css")" rel="stylesheet" type="text/css" />放在你的头部标签中 -
@DatoMaisuradze 我将它们包含在 BundleConfig.cs
code 'bundles.Add(new ScriptBundle("~/bundles/otf").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/jquery-ui-{version}.js", "~/Scripts/jquery.unobtrusive*", "~/Scripts/jquery.validate*", "~/Scripts/otf.js", "~/Scripts/bootstrap.js", "~/Scripts/bootstrap.min.js" )); -
@DylanKilkenny 它有效,谢谢!
-
@DylanKilkenny 不幸的是,它没有输出我在 thead 元素中指定的那个。它获得了样式,但不是我想要的样式!看看我的 _partial:`code@Html.PagedListPager(Model, page =>Url.Action("Index", new {page}) ,PagedList.Mvc.PagedListRenderOptions.MinimalWithItemCountText)
标签: asp.net asp.net-mvc twitter-bootstrap asp.net-mvc-4