首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >E4000 - [DevExpress.data]:错误:错误。dx.all.debug.js:28351 (请看截图)

E4000 - [DevExpress.data]:错误:错误。dx.all.debug.js:28351 (请看截图)
EN

Stack Overflow用户
提问于 2021-10-31 13:28:06
回答 1查看 213关注 0票数 0

在浏览器上查看我的Index.cshtml视图时,我总是遇到这种显示。(请参阅截图)。我创建了一个ASP.NET MVC 5应用程序是针对.NET Framework4.8的Web 项目。我在项目中添加了DevExtreme,并且都很成功。

现在,当我添加一个DevExtreme DataGrid时,没有错误,但是当我在浏览器中运行应用程序时,我会看到这个橙色的行,在DataGrid上方有一个标签“error”(请参见Screen快照)。

如果是关于我的布局和加载DevExtreme依赖项的顺序,请通知。

--这是我的代码示例:

代码语言:javascript
复制
**_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:

代码语言:javascript
复制
@{
   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:

代码语言:javascript
复制
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
 }

}

EN

回答 1

Stack Overflow用户

发布于 2021-11-01 12:59:14

我只是将RouteName属性添加到DevExtreme DataGrid,以指定它的路由。啊,真灵。

代码语言:javascript
复制
.RouteName("routename")
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69787359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档