0

I've faced a problem converting an Object into String in flex . my object is mydropdown selecteditem and I want to convert it to string and show it on a label tag . I've tried ".toString()" and "as String" and "String()" but none of them worked . anyone has any experience with it ? thanks

2 Answers 2

2

The selectedItem object has data and label properties, depending on the data that you're supplying you'd want something like this:

mydropdown.selectedItem.label
Sign up to request clarification or add additional context in comments.

3 Comments

didn't work . when I use mydropdown.selectedItem.label , it shows nothing .
Well it depends on the data that you're providing, using data and label is just convention. Is there a labelField that is defined for your DropDownList? In my example it would be labelField = "label".
thanks , that worked . my labelField="genre" and I used it like myDropDown.selectedItem.genre and it worked . thank you very much
0

If your "mydropdown selecteditem" is a class that you wrote yourself, you could create a toString() method in there and make it return something useful.

1 Comment

no . by mydropdown I meant the id of my DropDownList and it's selecteditem property

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.