Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Empty Row In Combo
Message
De
14/02/2009 11:45:41
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01381353
Message ID:
01381770
Vues:
20
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform