我最近将一个 Web 应用程序从 Telerik Mvc 迁移到了 Kendo UI,但我遇到了一个问题,我不太确定如何修改,因为我在过去一周学习了更多并习惯了 Kendo UI。
这是我遇到的问题。错误指出:
The call is ambiguous between the following methods or
properties: 'System.Linq.Enumerable.Where<Model_OpenAccess_AssetMgr.Custody>
(System.Collections.Generic.IEnumerable<Model_OpenAccess_AssetMgr.Custody>,
System.Func<Model_OpenAccess_AssetMgr.Custody,bool>)'
and 'System.Linq.Enumerable.Where<Model_OpenAccess_AssetMgr.Custody>
(System.Collections.Generic.IEnumerable<Model_OpenAccess_AssetMgr.Custody>,
System.Func<Model_OpenAccess_AssetMgr.Custody,bool>)'
发生错误的代码如下:
@model List<Model_OpenAccess_AssetMgr.Custody>
<div id="AssetDescription" class="detailContainer detailContainer3">
<header class="sectionheader" > Custodians </header>
@(Html.Kendo().Grid(Model.Where(x=>x.Active==true))
.Name("grd_Admin_Custodians")
.HtmlAttributes(new { @class = "ItemsGrid" })
.ToolBar(commands => commands.Create())
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(o => o.Custody_PK))
)
.DataSource(dataSource => dataSource
.Server()
.Read(read => read.Action("AdminHome", "Admin", new { view ="Custodies" }))
.Create("Create", "Admin", new { id = 0, view = "Custodies" })
.Update("Save", "Admin", new { view = "Custodies" })
.Destroy("Delete", "Admin", new { view = "Custodies" }))
.Columns(columns =>
{
columns.Bound(o => o.Custody_Name).Width(200);
columns.Bound(o => o.Custody_Dept).Width(150);
columns.Bound(o => o.Custody_eraider).Width(130);
columns.Bound(o => o.Custody_Type).Width(130);
columns.Bound(o => o.Custody_Email).Width(220);
{
commands.Edit();
commands.Destroy();
}).Width(210);
}
)
.Scrollable(scrolling => scrolling.Enabled(true)}
.Scrollable(scrolling => scrolling.Height(550))
.Pageable()
.Sortable()
)
</div>
)
(Model.Where(x=>x.Active==true) 是被标记的内容。
现在,我还在下面的顶部列出了一个警告
@model 列表说明:
ASP.NET runtime error: Method not found 'Void
System.Web.Razor.RazorEngineHost.set_EnableInstrumentation(Boolean)'
我很确定这与我遇到的错误有关。
我是否需要以某种方式修改 Model.Where() 语句?
你认为我应该用什么来代替剑道 UI?
另一方面,我最近将此 Web 应用程序项目从 MVC3 升级到 MVC4,所以我不知道这是否与此有关。但我也想继续让你知道这个事实。
我查看了其他回复,但似乎没有人专门针对 Kendo UI 询问过这个问题。
谢谢!