1

I recently migrated a web application from Telerik Mvc to Kendo UI, but I'm running into a snag that I'm not too sure how to modify since I've been learning more about and getting used to Kendo UI the past week.

Here is the problem I'm running into. The error states:

 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>)'

And the code where the error is occurring is below:

@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) is what is being flagged.

Now, I also have a warning listed at the top underneath

@model List that states:

ASP.NET runtime error: Method not found 'Void  
System.Web.Razor.RazorEngineHost.set_EnableInstrumentation(Boolean)'

Which I'm quite certain is interconnected with the error I'm getting.

Do I need to modify the Model.Where() statement somehow?

What do you think I should use instead for Kendo UI?

On another note I recently upgraded this web application project from MVC3 to MVC4 so I don't know if that has anything to do with this or not. But I wanted to go ahead and let you know of that fact as well.

I've looked at other responses but it appears no one has asked about this for Kendo UI specifically.

Thanks!

Ogreintel
  • 1,143
  • 2
  • 11
  • 15

1 Answers1

1

It looks to me like you are mixing Server side rendering and Ajax rendering. If using Server side rendering of your grid, you should perform the Where(x=>x.Active==true) filtering in your Model (preferably) or in the Controller Action (less ideal) that uses this view. Not in the view.

If using an Ajax to get the data, say for a paged grid, your datasource needs a read method like

 .Read(read => read.Action("Custodians", "Admin"))
Daniel Dyson
  • 13,192
  • 6
  • 42
  • 73
  • Yeah, I have .Read(read => read.Action("Custodians", "Admin")) listed below the "..." portion of the code. I may very well be mixing Server side rendering and Ajax rendering. But if this is true, what do you suggest I remove or modify to solve the issue. I've updated my original post that includes the full code now so you can have a better idea of what I'm working with. – Ogreintel Sep 16 '14 at 14:08