I have a listbox that needs to be populated by directories. i have successfully filled the listbox with the Directories but my problem is i can't get the selected item's value. i placed a breakpoint on the SelectedIndexChanged event but my web application doesn't seem to run through that code.
Here is my code for populating the listbox:
lstDirectories.DataSource = dtDirectories;
lstDirectories.DataValueField = "DirectoryID";
lstDirectories.DataTextField = "DirectoryName";
lstDirectories.DataBind();
This is how i get value from the listbox on the SelectedIndexChanged Event:
TextBox1.Text = lstDirectories.SelectedItem.Value.ToString();
am i doing something wrong here? thanks for the help! :)
Use the property:-
AutoPostBack="True"
By default it is False
.