Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Empty Row In Combo
Message
De
14/02/2009 12:54:20
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01381353
Message ID:
01381787
Vues:
16
>What I did which seemed to work was insert a row into the DS with "None" using the Table.InsertAt() method so that it is the first row in the DS.

Well, ok, whatever your requirements are for your app. But personally, I, as a user, would rather see an empty ComboBox rather than the word "None".

~~Bonnie



>
>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform