bind a dropdownlist (which outside grid) all values to array using Javascript
After that i want to bind that array values to dropdownlist inside gridview
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anubhav ChaudharyPosted Sep 4, 2014, 8:51 AM
for sending the values to array you can use this code:
array=[];
This will send the text of options available in the array whose name is "array", if you want to send the value to array then simply replace $(this).text() with $(this).val().
After this when you want to bind the array values then apply for function on array which will start from "0" to array.length, and add the option in which value from array will be fetched in this manner:
$("#idofDropdown").append(new Option("array[i].text", "array[i].val"));