How to bind remote data from DB to kendo dropdownlist using Jquery in C#

Let us consider the below example,

Step 1: Consider the below textbox for which we want to bind dropdownlist using kendo.

Sample code:

<div class="col-md-3">
          <label for="validationServer01" style="color: #6f90a3">Week Ending Date</label>                                       <input id="products" style="width: 270px" />
 </div>

Step 2: Let's write the Jquery script to get the dropdown list from webservice and bind it to input element  and initialize kendo dropdown.

Sample code:

<script>
        $(document).ready(function () {

            $("#products").kendoDropDownList({
                filter: "contains",
                optionLabel: "Select WeekEndingDate",
                dataTextField: "WeekendingValue",
                dataValueField: "WeekendingValue",
                dataSource: {
                    transport: {
                        read: {
                            type: "GET",
                            url: 'WS_Equipment.asmx/GetWeekendingDate',
                            dataType: "json"
                        }
                    }
                }
            });
});
</script>

In the above code, we used asmx webservice and defined service 'GetWeekendingDate' in the asmx file.
By following the above steps you can easily bind the remote data or Db to dropdown using jquery.

Popular posts from this blog

Top MNC Interview Questions- Full Stack Developer

Interview Questions-2

How to get the user details, user current level, next level, Rank in sql server