Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SelectedValue in Dropdown
Message
From
02/03/2006 15:53:16
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
SelectedValue in Dropdown
Miscellaneous
Thread ID:
01101063
Message ID:
01101063
Views:
73
Using VS2005, I am creating a Asp.Net Webform. This form has a dropdown list webcontrol. I want to populate the dropdown with data from a table and set it's SelectedValue property. All of this works except for the SelectedValue.

When I look at the HTML source in IE, I notice that the Value tag for the dropdown has trailing spaces next to the value. For Example:
<option value="0006   ">Description for 0006</option>
<option value="0007   ">Description for 0007</option>
How do I remove these trailing spaces behind the 0006 and 0007? The only way I can set a SelectedValue for this dropdown is to include the trailing spaces. I prefer not to do this. Below shows two examples, one works the other doesn't. How can I get example one to work?
//Example one
this.cbo_soplant.SelectedValue = "0006";   //Does not work.
//Example two
this.cbo_soplant.SelectedValue = "0006   ";  //Works.
Thanks,

Jerry
Next
Reply
Map
View

Click here to load this message in the networking platform