Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty Row In Combo
Message
From
14/02/2009 11:45:41
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01381353
Message ID:
01381770
Views:
19
Kevin,

You're close ... in addition to setting the .SelectedIndex to -1, you also need to set the .SelectedValue. If you've bound your ValueMember to a string, then that's easy, just set the .SelectedValue to "". It's more complicated if it's bound to a numeric column, such as an int ... in those cases we've set the .SelectedValue to a default of 0 ... your choice of default may differ depending on your app.

~~Bonnie




>I have a stored procedure which returns a distinct list of categories. I call it via a strored proc and bind the DS to a combo.
>
>Problem is, once the user selects an item in the combo, there's no way to choose nothing. There's no empty row. Initially I have set the combo's SelectedIndex to -1, but that doesn't allow the user to unselect the selected item in the combo.
>
>Anyone?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform