Click here to Skip to main content
15,913,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,

I have the Code as follows.

C#
function GetDisplayQCID() {
            debugger;
            $.ajax({
                url: 'QCAllocation.aspx/GetDisplayQCID',
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                dataType: "json",
                success: function (result) {
                    debugger;
                    if (result.d != '') {
                        if (result.d != '' && result.d != null) {
                            DisplayQCIDList = JSON.parse(result.d);

                            var drawRow = function (qcIDs) {
                                var dropdown = document.getElementById('qcSelect');
                                for (var i = 0; i < qcIDs.length; i++) {
                                    var opt = document.createElement('option');
                                    opt.innerHTML = qcIDs[i].NetworkId;
                                    dropdown.appendChild(opt);
                                }
                            }

                            drawRow(DisplayQCIDList);
                            manageOverlay(false);
                        }
                    }

                },
                error: function (error) {
                    manageOverlay(false);
                    alert(error.responseText);
                },
                async: false
            })
        };


As In below
var dropdown = document.getElementById('qcSelect');

I am getting the value in qcSelect Combo box. But if i want the same value in other Combo box How it possible.

Please Guide.
Thanks
Harshal
Posted

1 solution

Please look at this link...
Copy all Options to another Select element
 
Share this answer
 
Comments
[no name] 28-Mar-14 10:23am    
Thank you for your reply .
I have try this
function GetDisplayQCID() {
debugger;
$.ajax({
url: 'QCAllocation.aspx/GetDisplayQCID',
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: "json",
success: function (result) {
debugger;
if (result.d != '') {
if (result.d != '' && result.d != null) {
DisplayQCIDList = JSON.parse(result.d);
var drawRow = function (qcIDs) {

var dropdownQC = document.getElementById('qcSelect');
var dropdownAllocateToQC = document.getElementById('allocateToSelect');

dropdownAllocateToQC.innerHTML = dropdownAllocateToQC.innerHTML + dropdownQC.innerHTML;
for (var i = 0; i < qcIDs.length; i++) {
var opt = document.createElement('option');
opt.innerHTML = qcIDs[i].NetworkId;
dropdownQC.appendChild(opt);
}
}

drawRow(DisplayQCIDList);
manageOverlay(false);
}
}

},
error: function (error) {
manageOverlay(false);
alert(error.responseText);
},
async: false
})
};
but it dont works.
In Details
I have two Combox with ID name as follow:
1.ComboBox with 'qcSelect' ComboboxID
2.ComboBox with 'allocateToSelect' ComboboxID

Now I want the same value in 'allocateToSelect' ComboBoxId from 'qcSelect' ComboboxID.
And i have this as follows.
<select id="qcSelect" class="combo150" style="width: 180px;">
<option>Select </option>
</select>

<select id="allocateToSelect" class="combo150">
<option>Select </option>
</select>

Please Guide Me
Thanks
Harshal
[no name] 28-Mar-14 11:26am    
Thank You So much punam.
I got idea from the link which you send me .
Thank You So Much.

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