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;
Vincent Maverick DuranoPosted Nov 4, 2019, 5:01 PM
rickPosted Nov 4, 2019, 4:04 PM
Sorry to have bother you with this. Turns out that that it didn't like have the same value in two different items.
go figure.
Vincent Maverick DuranoPosted Nov 4, 2019, 3:23 PM