Listbox selectedIndexChanged doesn't fire when selecting an item from the list

asp.net, c#, listbox, selectedindexchanged

Solution

Use the property:-

`AutoPostBack="True"`

By default it is `False`.

Problem

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! :)

Original source