In this post, is going to share the how to bond the kendo ui
Combo Box & how to get the value and text using this.value(), this.text()
and we can use as per need.
This combo box wok with filter. If you want to filter the drop-down the it possible.
The Razor view code sample :
<div class="col-lg-12">
<input type="text" id="txt_filterCustomer"/>
</div>
The JavaScript code sample :
<script type="text/javascript">
var _empId = mySession().ID; //This
is a Id.
$(function () {
$("#txt_filterCustomer").kendoComboBox({
placeholder: "-- Select Employee --",
dataTextField: "EmpName",
dataValueField: "EmpID",
filter: "contains",
autoBind: false,
minLength: 1,
dataSource: {
transport: {
read: {
url:"localhost://8080/API/Company/GetEmployee/" + _empId
}
}
},
change: function () {
employeeList(this.value(), this.text());
}
});
function employeeList(key, val) {
if (key !== undefined && val !== undefined) {
alert('key : ' + key);
alert('val : ' + val);
}
}
});
</script>