gpt4 book ai didi

asp.net-mvc-4 - 无法在 mvc4 中将 kendo ui 与 vs 2012 集成

转载 作者:行者123 更新时间:2023-12-04 02:43:50 25 4
gpt4 key购买 nike

我正在使用 VS 2012 并尝试在其中集成 Kendo UI。我已经安装了 nuget“Kendo UI”并且还在 _Layout.cshtml 中提供了引用

 <link rel="stylesheet" href="@Url.Content("~/Content/kendo/2013.2.716/kendo.common.min.css")">
<link rel="stylesheet" href="@Url.Content("~/Content/kendo/2013.2.716/kendo.default.min.css")">
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/jquery.min.js")"></script>

当我试图采取新的观点时,剑道不支持

如果我在 customerdetail.cshtml 中写入以下代码

@(Html.Kendo().Grid<KendoUIDemo.Models.Customer>()
.Name("grid")
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("CustomerDetail", "Home")) // Set the action method which will return the data in JSON format
)
.Columns(columns =>
{
// Create a column bound to the ProductID property
columns.Bound(product => product.ProductID);
// Create a column bound to the ProductName property
columns.Bound(product => product.ProductName);
// Create a column bound to the UnitsInStock property
columns.Bound(product => product.UnitsInStock);
})
.Pageable() // Enable paging
.Sortable() // Enable sorting

)

错误:- System.Web.Mvc.HtmlHelper' 不包含 'Kendo' 的定义,并且找不到接受类型为 'System.Web.Mvc.HtmlHelper' 的第一个参数的扩展方法 'Kendo'(是您是否缺少 using 指令或程序集引用?)

任何想法告诉我已经在 View 的 wen.config 中添加引用提前致谢!!

最佳答案

请参阅初始设置指南的文档 - http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction .

在您的 Web Project\Views\Web.config 文件中,检查是否将 Kendo.Mvc 和 Kendo.Mvc.UI 添加为命名空间。

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
...
<add namespace="Kendo.Mvc"/>
<add namespace="Kendo.Mvc.UI"/>
</namespaces>
</pages>
</system.web.webPages.razor>

在您的 Web Project\Web.config 文件中,您可能需要以下内容

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
....

同时检查您的项目引用,以便您引用

Kendo.Mvc
System.Web.Helpers

关于asp.net-mvc-4 - 无法在 mvc4 中将 kendo ui 与 vs 2012 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19288879/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com