Kendo grid throws error

2 posts, 0 answers
  1. Byron
    Byron avatar
    1 posts
    Member since:
    Aug 2015

    Posted 24 Sep 2015 Link to this post

    I have a grid defined thusly: 

    @Model VendorManagement.Web.Models.RiskExposureViewModel
    @using Kendo.Mvc.UI


         .Columns(columns =>
                                    columns.Bound(c => c.RiskUnit).Title("Risk Unit");
                                    columns.Bound(c => c.RiskCategory).Title("Risk Category");
                                    columns.Bound(c => c.RiskDescription).Title("Short Description");
                                .Read(read => read.Action("BindRiskMatrixGrid", "Risk"))

    RiskMatrixExposureList is a List<RiskMatrixExposure>. The grid as defined is throwing the following error in Razor:

    "Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type"

     I have the namespace defined in Views/web.config:

        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Optimization"/>
            <add namespace="System.Web.Routing" />
            <add namespace="VendorManagement.Web" />
            <add namespace="Kendo.Mvc.UI" />


    Thanks for they help!


  2. Nikolay Rusev
    Nikolay Rusev avatar
    2275 posts

    Posted 28 Sep 2015 Link to this post

    Hello Byron,


    The casing for model directive is incorrect - `@Model` it should be with lower `m`. I've attached a runnable example.


    Nikolay Rusev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top