Author: jerry.tovar | Posted on: 5/11/2010 3:27:57 PM | Views : 478

I have a ASP.Net webform with a DropDownList control. This Dropdown gets it's values from a states table in an ObjectDatasource. The Dropdown contains states spelled out.
If I try to set the drop down to:  
      DropDownStates.SelectdValue = "Ohio"   

I get an error that the value does not exist in the dropdown even though it does exist. But if I pad the value with the correct number of spaces to the right, it works like so:
     DropDownStates.SelectdValue = "Ohio        "
or
     DropDownStates.SelectdValue = "Michigan     "

How can I either define the dropdown without trailing spaces in the value of the dropwdown or set the SelectedValue with adding trailing spaces?

...

Go to the complete details ...