我之前见过这个问题,但这些答案都不适合我。 而不是添加行:
<script src="@Url.Content("~/Scripts/jquery.min.js")" type="text/javascript"> </script>
<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/gridmvc.min.js")" type="text/javascript"> </script>
我在BundleConfig.cs文件中使用了它
bundles.Add(new ScriptBundle("~/bundles/gridmvc").Include("~/Scripts/gridmvc*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css", "~/Content/bootstrap*", "~/Content/gridmvc.css"));
这是_Layout.cshtml头
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/gridmvc")
@Styles.Render("~/Content/css")
@RenderSection("scripts", required: false)
</head>
当然我添加了@using GridMvc.Html 到View文件 我得到网格,但没有应用任何样式(只是内置MVC样式)和过滤不起作用,所以我想脚本不工作。订购和分页工作 这就是我得到的http://i61.tinypic.com/33z62a1.png