I have a WebForm application with a dropdownlist. The datasource for the dropdown is a DataTable with 4 item. The DataTable is built in codebehind.
DataTable rn = new DataTable();
rn.Columns.Add(new DataColumn("command", typeof(string)));
DataRow dr;
dr = rn.NewRow();
dr["command"] = "Update Page";
dr["url"] = "~/MX/MXEntities.aspx";
rn.Rows.Add(dr); 3 more just like this
Each item has 2 columns. The dropdown displays correctly however when selecting the first or second item, index of 0 is always returned. Items 3 or 4 always returns index of 2.
string index = allTable.SelectedIndex.ToString();
string selectedvalue = allTable.SelectedItem.Value;
string selectedtext = allTable.SelectedItem.Text;