How To Change DropDownList Selected Value In Javascript?
how to change the selected value in javascript and get the selected value in codebehind page? AutoPostBack is set to false.
Solution 1:
You can change it like this:
var ddl = document.getElementById('ddl-id');
var opts = ddl.options.length;
for (var i=0; i<opts; i++){
if (ddl.options[i].value == "some-value"){
ddl.options[i].selected = true;
break;
}
}
Solution 2:
//setting the value of a drop down list
document.getElementById('my_drop_down').selectedIndex=2;
Post a Comment for "How To Change DropDownList Selected Value In Javascript?"