Get select value from kendo ui comboBox

Get select value from kendo ui comboBox

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>

ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.