error when adding events

2 posts, 1 answers
  1. Christian Sandöy
    Christian Sandöy avatar
    58 posts
    Member since:
    Aug 2005

    Posted 31 Jul 2017 Link to this post

    When I try to  add event to a multiselect I get this error

    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 tried these to method to add event

    @(Html.Kendo().MultiSelectFor(m => m.OmviserNavne)
                                        .Placeholder("Vælg omviser...")
                                        .Events(e =>

    @(Html.Kendo().MultiSelectFor(m => m.OmviserNavne)
                                        .Placeholder("Vælg omviser...")
                                        .Events(events => events.Change("onOmviserChange"))

  2. Answer
    Dimitar avatar
    807 posts

    Posted 02 Aug 2017 Link to this post

    Hello Christian,

    I am attaching an ASP.NET Core solution where a similar scenario to the one described is demonstrated (Kendo UI MultiSelect with server binding).

    In order to fix the error, you can cast the ViewBag variable to an explicit type:

    Another alternative would be to simply move the .Events(...) definition before BindTo(...). Both of the suggested approaches should be able to solve the issue.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top