在浏览器上查看我的Index.cshtml视图时,我总是遇到这种显示。(请参阅截图)。我创建了一个ASP.NET MVC 5应用程序,是针对.NET Framework4.8的Web 项目。我在项目中添加了DevExtreme,并且都很成功。
现在,当我添加一个DevExtreme DataGrid时,没有错误,但是当我在浏览器中运行应用程序时,我会看到这个橙色的行,在DataGrid上方有一个标签“error”(请参见Screen快照)。
如果是关于我的布局和加载DevExtreme依赖项的顺序,请通知。
--这是我的代码示例:
**_Layout.cshtml:**
<!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")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Styles.Render("~/Content/DevExtremeBundle")
@Scripts.Render("~/Scripts/DevExtremeBundle")
@RenderSection("scripts", required: false)
</head>
<body>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>Index.cshtml:
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@(Html.DevExtreme().DataGrid<LMS_v1._1.Areas.Admin.Data.Country>()
.DataSource(ds => ds.WebApi()
.Controller("CountryWeb")
.LoadAction("Get")
.InsertAction("Post")
.UpdateAction("Put")
.DeleteAction("Delete")
.Key("CountryId")
)
.RemoteOperations(true)
.Columns(columns => {
columns.AddFor(m => m.CountryCode);
columns.AddFor(m => m.CountryName);
})
.Editing(e => e
.AllowAdding(true)
.AllowUpdating(true)
.AllowDeleting(true)
)
)DevExtremeBundleConfig:
public class DevExtremeBundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
var styleBundle = new StyleBundle("~/Content/DevExtremeBundle");
var scriptBundle = new ScriptBundle("~/Scripts/DevExtremeBundle");
// Uncomment to use the Gantt control
// styleBundle.Include("~/Content/dx-gantt.css");
// Uncomment to use the Diagram control
// styleBundle.Include("~/Content/dx-diagram.css");
styleBundle.Include("~/Content/dx.common.css");
// Predefined themes: https://js.devexpress.com/DevExtreme/Guide/Themes_and_Styles/Predefined_Themes/
styleBundle.Include("~/Content/dx.light.css");
// styleBundle.Include("~/Content/dx.Carmine.css");
// Uncomment to use the Gantt control
// scriptBundle.Include("~/Scripts/dx-gantt.js");
// Uncomment to use the Diagram control
//scriptBundle.Include("~/Scripts/dx-diagram.js");
// NOTE: jQuery may already be included in the default script bundle. Check the BundleConfig.cs file.
//scriptBundle.Include("~/Scripts/jquery-3.4.1.js");
// Uncomment to use Globalize for localization
// Docs: https://docs.devexpress.com/DevExtremeAspNetMvc/400706#globalize
// scriptBundle.Include("~/Scripts/cldr.js");
// scriptBundle.Include("~/Scripts/cldr/event.js");
// scriptBundle.Include("~/Scripts/cldr/supplemental.js");
// scriptBundle.Include("~/Scripts/cldr/unresolved.js");
// scriptBundle.Include("~/Scripts/globalize.js");
// scriptBundle.Include("~/Scripts/globalize/message.js");
// scriptBundle.Include("~/Scripts/globalize/number.js");
// scriptBundle.Include("~/Scripts/globalize/currency.js");
// scriptBundle.Include("~/Scripts/globalize/date.js");
// Uncomment to enable client-side export
scriptBundle.Include("~/Scripts/jszip.js");
scriptBundle.Include("~/Scripts/dx.all.js");
// Uncomment to provide geo-data for the VectorMap control
// Docs: https://js.devexpress.com/DevExtreme/Guide/Widgets/VectorMap/Providing_Data/Data_for_Areas
// scriptBundle.Include("~/Scripts/vectormap-data/world.js");
scriptBundle.Include("~/Scripts/aspnet/dx.aspnet.mvc.js");
scriptBundle.Include("~/Scripts/aspnet/dx.aspnet.data.js");
bundles.Add(styleBundle);
bundles.Add(scriptBundle);
#if !DEBUG
BundleTable.EnableOptimizations = true;
#endif
}}
发布于 2021-11-01 12:59:14
我只是将RouteName属性添加到DevExtreme DataGrid,以指定它的路由。啊,真灵。
.RouteName("routename")https://stackoverflow.com/questions/69787359
复制相似问题