Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Change Dropdownlist based on value returned in AJAX

$
0
0

I am setting up a page to copy values from an existing record and paste them into a new record to save the user filling out a lengthy form with similar information.

I have successfully been able to retrieve values and paste them into the fields for the text boxes. I am struggling with being able to get my drop down lists to change their values to match the copied record.

The drop down lists get their values from a look up table within the database.

The JS code I am using is:

$.ajax({
        type: "POST",
        url: "WSHardware.asmx/GetHardware",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {

            var jhardwareitems = response.d;
            $('#HardwareDetails').empty();$.each(jhardwareitems, function (index, jhardware) {

                //Populating TextBoxes in InsertItemTemplate
                $('input[id$=HWNameTextBox]').val(jhardware.HardwareName);$('input[id$=ModelNoTextBox]').val(jhardware.ModelNo);$('dropdown.options[id$=DropDownList_Kit]').val(jhardware.KitID); //<-- CANT GET THIS TO CHANGE VALUE IN MY DROPDOWNLIST

             // Shortened for clarity

Any ideas?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>