views:

238

answers:

1

I'm trying to extract the selected value from a a DropDownList as a string as follows:

if ((ASPxComboBox1.SelectedItem.Value).ToString = "Selection")

This is not working. Please let me know if there is a away of getting each selected string extracted?

+1  A: 

Your syntax seems odd but try (I am assuming c# because you didn't specify the language your using):

if (ASPxComboBox1.SelectedValue.Equals("Selection"))

In your code you are doing an assignment and assigning the text "Selection" to ToString which shouldn't even compile.

Also you named it a combobox but ASP.NET does not have a combobox just a dropdownlist...

Kelsey
Thx,Im new to ASP.net,so trying these for the first time.I was able to get there working through your solution.
LSB
@LS if this answer helped you, you should mark it as the accepted answer. You have a 0% accept rate so you should go through the questions you have answer and improve your accepted answer rate as it will help others viewing your questions in the future.
Kelsey
How do I accepet a answer please? When I try to click the answer is useful it always ask for the openID ,eventhough I am already logged in.So end up not doing anything to the answer.Thanks for ur comments
LSB
@LS trying logging out and back in. Then you can just click the checkmark next to the answer you want to be the accepted answer. If it still doesn't work you might want to report a bug on http://meta.stackoverflow.com
Kelsey