在我的应用程序中,我使用下面的Bundle选项引用了JQWidget库和样式。
bundles.Add(new ScriptBundle("~/bundles/jqwidgets").Include(
"~/JQWidgets/jqx-all.js",
"~/JQWidgets/jqxcore.js",
"~/JQWidgets/jqxdata.js",
"~/JQWidgets/jqxgrid.js",
"~/JQWidgets/jqxgrid.selection.js",
"~/JQWidgets/jqxgrid.pager.js",
"~/JQWidgets/jqxlistbox.js",
"~/JQWidgets/jqxbuttons.js",
"~/JQWidgets/jqxscrollbar.js",
"~/JQWidgets/jqxdatatable.js",
"~/JQWidgets/jqxtreegrid.js",
"~/JQWidgets/jqxmenu.js",
"~/JQWidgets/jqxcalendar.js",
"~/JQWidgets/jqxgrid.sort.js",
"~/JQWidgets/jqxgrid.filter.js",
"~/JQWidgets/jqxdatetimeinput.js",
"~/JQWidgets/jqxdropdownlist.js",
"~/JQWidgets/jqxslider.js",
"~/JQWidgets/jqxeditor.js",
"~/JQWidgets/jqxinput.js",
"~/JQWidgets/jqxdraw.js",
"~/JQWidgets/jqxchart.core.js",
"~/JQWidgets/jqxchart.rangeselector.js",
"~/JQWidgets/jqxtree.js",
"~/JQWidgets/globalize.js",
"~/JQWidgets/jqxbulletchart.js",
"~/JQWidgets/jqxcheckbox.js",
"~/JQWidgets/jqxradiobutton.js",
"~/JQWidgets/jqxvalidator.js",
"~/JQWidgets/jqxpanel.js",
"~/JQWidgets/jqxpasswordinput.js",
"~/JQWidgets/jqxnumberinput.js",
"~/JQWidgets/jqxcombobox.js",
"~/JQWidgets/jqxgrid.edit.js",
"~/JQWidgets/jqxgrid.columnsresize.js",
"~/JQWidgets/jqxgrid.columnsreorder.js",
"~/JQWidgets/jqxdata.js",
"~/JQWidgets/jqxgrid.export.js",
"~/JQWidgets/jqxdata.export.js",
"~/JQWidgets/jqxgrid.grouping.js",
"~/JQWidgets/jqxgrid.aggregates.js",
"~/JQWidgets/jqxtabs.js",
"~/JQWidgets/jqxwindow.js"
));
bundles.Add(new StyleBundle("~/JQWidgets/Styles/css").Include(
"~/JQWidgets/Styles/jqx.base.css",
"~/JQWidgets/Styles/jqx.arctic.css",
"~/JQWidgets/Styles/jqx.black.css",
"~/JQWidgets/Styles/jqx.bootstrap.css",
"~/JQWidgets/Styles/jqx.classic.css",
"~/JQWidgets/Styles/jqx.darkblue.css",
"~/JQWidgets/Styles/jqx.energyblue.css",
"~/JQWidgets/Styles/jqx.fresh.css",
"~/JQWidgets/Styles/jqx.highcontrast.css",
"~/JQWidgets/Styles/jqx.metro.css",
"~/JQWidgets/Styles/jqx.metrodark.css",
"~/JQWidgets/Styles/jqx.office.css",
"~/JQWidgets/Styles/jqx.orange.css",
"~/JQWidgets/Styles/jqx.shinyblack.css",
"~/JQWidgets/Styles/jqx.summer.css",
"~/JQWidgets/Styles/jqx.web.css",
"~/JQWidgets/Styles/jqx.ui-darkness.css",
"~/JQWidgets/Styles/jqx.ui-lightness.css",
"~/JQWidgets/Styles/jqx.ui-le-frog.css",
"~/JQWidgets/Styles/jqx.ui-overcast.css",
"~/JQWidgets/Styles/jqx.ui-redmond.css",
"~/JQWidgets/Styles/jqx.ui-smoothness.css",
"~/JQWidgets/Styles/jqx.ui-start.css",
"~/JQWidgets/Styles/jqx.ui-sunny.css",
"~/JQWidgets/Styles/bootstrap.css",
"~/JQWidgets/Styles/site.css"
));
BundleTable.EnableOptimizations = true;
在我的_Layout.cshtml
中,我分别在head
和body
标记中引用了这些内容。
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Gulf Piping Company</title>
@Styles.Render("~/Content/css")
**@Styles.Render("~/jqwidgets/styles/css")**
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
**@Scripts.Render("~/bundles/jqwidgets")**
@Scripts.Render("~/bundles/ajax")
@RenderSection("scripts", required: false)
现在,由于我的应用程序处于开发阶段,因此我继续运行应用程序,进行更改并根据需要刷新浏览器。经过一定数量的刷新(无法告诉多少),我收到此错误消息。
我必须关闭浏览器,关闭Visual Studio,然后重新运行Visual Studio,再次加载解决方案,然后运行应用程序以克服此错误。谁能告诉我这里发生了什么?
另外,我的应用程序中有不同的视图/页面,有些页面引用了上面的JQWidget
个库,有些页面没有(即并非所有页面都使用了所有这些库),所以{{1}真的是正确的使用方式,还是有更好的方法来引用库?