G
Guest
I populate an unbound ListBox on a WebForm with the following C# code.
SqlDataReader oDr = sqlCommandGetTableList.ExecuteReader();
ListBoxTableName.DataSource = oDr;
ListBoxTableName.DataValueField = "TABLE_NAME";
ListBoxTableName.DataBind();
But when the WebForm is displayed and I highlight a TABLE_NAME in the
listbox the ListBoxTableName_SelectedIndexChanged method fires, but the
SelectedIndex value is -1. What am I doing wrong?
SqlDataReader oDr = sqlCommandGetTableList.ExecuteReader();
ListBoxTableName.DataSource = oDr;
ListBoxTableName.DataValueField = "TABLE_NAME";
ListBoxTableName.DataBind();
But when the WebForm is displayed and I highlight a TABLE_NAME in the
listbox the ListBoxTableName_SelectedIndexChanged method fires, but the
SelectedIndex value is -1. What am I doing wrong?