Question

I have a drop down list that gets its data from a php web service method.This response is smthing like :

array('id'=>integer,'name'=>'lin')

When the page loads, I want to set the selected index to "lin" initially. How do I do this ?

Was it helpful?

Solution

you just need to set selectedIndex property of dropdownlist control.

ex.

dwl.selectedIndex = 1; // "Index of "lin"

you should do this.

var iIndex:int;

for(var i:int = 0; i < arrResponse.length; i++)
{

       // if(Array(arrResponse[i])[1] == "lin")

       if(Array(arrResponse[i]).name == "lin") {
            iIndex = i;

       }

}

dwl.selectedIndex = iIndex;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top