Multiple Event Handlers

4 posts, 1 answers
  1. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 01 Apr 2015 Link to this post

    I am trying to have two javascript methods that get called when the change event on a DropDownList is raised.  If I set it up like this:

    @(Html.Kendo().DropDownListFor(m => m)
    ...
    .Events(e => e.Change("Method1").Change("Method2"))
    )

    Then only Method2 is called.  I can work around this a little bit by creating a third function, but then if I need the "this" variable from the event it looks like I have to pass it as a parameter to Method1 and Method2.

    Is it possible to have multiple handlers registered for one event on a kendo control?
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 02 Apr 2015 Link to this post

    Hello Brian,

    Can this issue be related to this known problem? If so, note it has been verified and fixed shortly after our Q1 2015 release, and we apologize for the inconvenience it caused you. The fix is included in the latest internal build of the product, which is available for download from your Telerik account's > DevCraft Ultimate > UI for ASP.NET MVC product downloads section.

    Please migrate to the new version and let us know whether this helps.

    Kind regards,
    Sebastian
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 02 Apr 2015 in reply to Sebastian Link to this post

    Sebastian,

    Thank you for your reply.  I don't think my situation is the same as that bug.  If I register one event handler for the change event, it works.  If I register two event handlers for the change event, only the second one is called.

    Thanks,
    Brian
  5. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 06 Apr 2015 Link to this post

    Hello Brian,

    The Fluent API of the wrappers is designed to override previous setting when same method is called. In this case, the sacond Change call will override the previous one. This behavior is expected and the only to accomplish your goal is to either use 3rd function or wire the events manually using JavaScript.

    Regards,
    Georgi Krustev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready