Hi, I am using Kendo for ASP.Net MVC version 2015.2.264
I am trying to set the selected value of a dropdown list programatically via javascript as follows, but it always returns null:
var ddl = $("#selDFTAlignment").data("kendoDropDownList");
if (ddl == null) { alert('null ddl'); return; }
ddl.select("1");
I use the MVC wrappers to define the dropdown which generates the dropdown script as follows:
jQuery(function(){jQuery("#selDTFAlignment").kendoDropDownList({"dataSource":[{"Text":"Left","Value":"0"},{"Text":"Centre","Value":"1"},{"Text":"Right","Value":"2"}],"dataTextField":"Text","template":"\u003cspan\u003e#:data.Text#\u003c/span\u003e","valueTemplate":"\u003cspan\u003e#:data.Text#\u003c/span\u003e","dataValueField":"Value"});});
The dropdown list is inside a div container for a modal popup:
<div id="mdlDefaultText" class="modal fade" role="dialog">
Why is the selector not working? Am I missing something?