Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if i selected any record i want highlight the selects item in multiple select option i write this line in json but it doesn't work please help me



C#
BindAgnGroup(document.getElementById("cmb_agency"));
           //BindAgnGroup(document.getElementById("cmb_group")).value = response.d[0].agroup;

           var selected = document.getElementById('cmb_group');
           //selected.onchange = function () {
           for (var i = 0; i < response.d[0].agroup.length; i++) {

               selected.options[i].selected = true;

           }
Posted
Updated 19-Aug-14 20:32pm
v3
Comments
Prasad Avunoori 18-Aug-14 7:07am    
Can you please elaborate more?
manoj s sherje 18-Aug-14 8:32am    
sir i have <select id="cmb_group" multiple="multiple" style="width:200px">
</select> control i bind some item like(Object1,Object3,Object2) save time i select Object2, if i selected prticular record then highlight the Object3 in select box

i using json to do this but i fail please if you solution help me i giving my code

BindAgnGroup(document.getElementById("cmb_agency"));
//BindAgnGroup(document.getElementById("cmb_group")).value = response.d[0].agroup;

var selected = document.getElementById('cmb_group');
//selected.onchange = function () {
for (var i = 0; i < response.d[0].agroup.length; i++) {

selected.options[i].selected = true;

}

1 solution

You do not need to write anything to display multiple selected values. Because you are already writing multiple="multiple" which specifies that multiple options can be selected at once.To do that you need to hold down(press)the control(ctrl)button/key to select multiple options.
 
Share this answer
 
Comments
manoj s sherje 20-Aug-14 2:11am    
mam i think your not understand my question my question is
i select any particular record using select command those item present in list box highlight in list box out of 6 to 8
like naukri.com profile
Prasad Avunoori 20-Aug-14 3:15am    
Not clear again.

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