我正按照https://documentation.devexpress.com/#AspNet/CustomDocument8998教程中的说明尝试使用DevExpress GridView。
页面出现,GridView显示数据,但GridView上的链接都没有工作。是否有一个我忘记的步骤?
更新:好的我找出了最初的问题。我没有在@Layout.cshtml页面中放置@ Html.DevExpress()。GetStyleSheets和@ Html.DevExpress()。GetScripts,以便解决链接根本无法工作的初始问题。但是现在,当我点击任何寻呼机链接时,......加载弹出窗口出现并且无休止地停留。当我点击删除链接时,它只能工作一次,如果我再次点击它,则没有任何反应。与编辑和添加链接相同。
答案 0 :(得分:0)
原来,_Layout.cshtml文件是罪魁祸首。我假设DevExpress会为我做,但问题是jQuery需要在调用@ Html.DevExpress()之前呈现.GetStyleSheets和@Html.DevExpress()。GetScripts。所以我将它们放在_Layout的head元素中,如下所示。一旦我这样做,GridView就可以了。
<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" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
@Html.DevExpress().GetStyleSheets(
new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
new StyleSheet { ExtensionSuite = ExtensionSuite.Editors },
new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor },
new StyleSheet { ExtensionSuite = ExtensionSuite.GridView },
new StyleSheet { ExtensionSuite = ExtensionSuite.PivotGrid },
new StyleSheet { ExtensionSuite = ExtensionSuite.Chart },
new StyleSheet { ExtensionSuite = ExtensionSuite.Report },
new StyleSheet { ExtensionSuite = ExtensionSuite.Scheduler },
new StyleSheet { ExtensionSuite = ExtensionSuite.TreeList },
new StyleSheet { ExtensionSuite = ExtensionSuite.Spreadsheet },
new StyleSheet { ExtensionSuite = ExtensionSuite.SpellChecker }
)
@Html.DevExpress().GetScripts(
new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
new Script { ExtensionSuite = ExtensionSuite.HtmlEditor },
new Script { ExtensionSuite = ExtensionSuite.GridView },
new Script { ExtensionSuite = ExtensionSuite.PivotGrid },
new Script { ExtensionSuite = ExtensionSuite.Editors },
new Script { ExtensionSuite = ExtensionSuite.Chart },
new Script { ExtensionSuite = ExtensionSuite.Report },
new Script { ExtensionSuite = ExtensionSuite.Scheduler },
new Script { ExtensionSuite = ExtensionSuite.TreeList },
new Script { ExtensionSuite = ExtensionSuite.Spreadsheet },
new Script { ExtensionSuite = ExtensionSuite.SpellChecker }
)