Change event: e.item is null

2 posts, 1 answers
  1. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 18 Aug 2012 Link to this post

    1) I am using the following code in the Change event:
    @(Html.Kendo().DropDownListFor(m => m.Page.PageSource)
                              .HtmlAttributes(new { id = "source" })
                              function(e) {

    and I get "undefined" when I change the item in the select list.

    2) Is there a way to have this event fire initally when the page loads?

    Thank you,
    David A
  2. Answer
    Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 20 Aug 2012 Link to this post

    Hello David,

    Straight upto your questions:

    1. The Change event of the Kendo DropDownList does not have "item" argument. If you need to get the selected data item, you can use the dataItem method. Check the API reference.

    2. The DropDownList is designed to not raise change event on initial load. You can trigger it manually:

    @(Html.Kendo().DropDownListFor(m => m.Page.PageSource)
                              //erased for brevity
                              function(e) {
          $(function() {
             var ddl = $("#Page_PageSource").data("kendoDropDownList");
              if (ddl) {  ddl.trigger("change"); }

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top