Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to cascade a dropdown with the data i enter into text box and the values matching with it and the datas should show

Eg: here if i enter cust_id in text box the dev_id matching with the cust_id should show in the drop down

below is the js i used to bind and show it

help me with it

TIA

What I have tried:

$.ajax({
                   type:
                   url: '@Url.Action("GetReportData", "Report")',
                   dataType: 'json',
                   data: { id: $("ddl_Devid").val() },
                   success: function (datas, custid) {
                       var duplicate = [];

                       $("#ddl_Devid").append('<option value="-1">' + "All" + '</option>');

                       $.each(datas, function (i, data) {
                           if (duplicate.indexOf(data.fld_dev_id) == -1) {
                               $("#ddl_Devid").append('<option value="' + data.fld_dev_id + '">' + data.fld_cust_id + '</option>');
                               duplicate.push(data.fld_dev_id);
                           }

                       });
                   }

               });
Posted
Updated 14-Sep-22 18:13pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900