Information générale
Catégorie:
Formulaires Web
Titre:
Accessing Selected Item in List Box
I'm new to the interfaces in .Net. On a webform, I'm trying to access the value of the selected item in a listbox. I tried the following, which returns an empty string:
String UserToDelete=this.UsersList.SelectedValue
We also tried:
String UserToDelete=this.UsersList.SelectedItem.ToString(), which gave us an exception - Object reference not set to an instance of an object.
What can I do to make UserToDelete equal the visible value in the listbox?
The listbox is a single column, listing users in the system. When I select on "Mr. Dingleberry", I want the UserToDelete string to equal "Mr. Dingleberry".
Thanks,
David
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement