i have implented Kendo ComboBox but struggling to get selected value ....
$("#_FeeScheme_Input").kendoComboBox({
minLength: 1,
filter: 'contains',
dataTextField: "FeeSchemeDescription",
dataValueField: "FeeSchemeID",
select: onSelect,
dataSource: {
type: "json",
serverFiltering: false,
transport: {
read: "/Qualification/GetAllFeeScheme_JSON"
},
}
});
...
function onSelect(e) {
var dataItem = this.dataItem(e.item.index());
alert("value " + dataItem.text); //NOT WORKING... RETURN NULL VALUE
};
<div class="form-group">
@Html.LabelFor(model => model._FeeScheme.FeeSchemeDescription, new { @class = "control-label col-md-3" })
<div class="col-md-6">
@Html.TextBoxFor(model => model._FeeScheme.FeeSchemeDescription, new { id = "_FeeScheme_Input" })
@Html.ValidationMessageFor(model => model._FeeScheme.FeeSchemeDescription)
</div>
</div>
var c = $('#MyCombo');
// to get selected id
c.val() // and also
c.data('kendoComboBox').value()
// to get selected text
c.data('kendoComboBox').text()
// to get selected item index
c.data('kendoComboBox').select()
// to set selected item e.g. 3
c.data('kendoComboBox').select(2)