Hi Rupen!!
first select box named with id="multiSel" is shown how programitacally(javascript) you can set the multi select box.
on the other hand if you are using asp/php/jsp<serverside> you can use id="multiSel1" method where there you can find multiple selected values.
I have just shown an example in such a way that only alternative options of id="multiSel" should be selected so i used i%2==0 method.If your selected options is based on any other logic you can put here that logic,as you are getting string with comma separated then you can split that string and put the logic.As i expected these are values must be selected in ur multiselect selectbox.
so you need to put your selection logic on if(i%2==0) line.e.g
********
<script>
function setMultiSelect()
{
var str=""
strVal="1,3,5,7"
obj=document.getElementById("multiSel")
ArrStr=strVal.split(",")
for(j=0;j<ArrStr.length;j++)
{
for(i=0;i<obj.length;i++)
{
if(parseInt(obj[i].value,10)==parseInt(ArrStr[j],10))
obj[i].selected=true
}
}
}
</script>
<body onload="setMultiSelect()">
<select id="multiSel" name="multiSel" multiple size=10 >
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
</select>
</body>
*************
Hope this will help you
Cheers :)
vinod
|