General information
Title:
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only