Last post Sep 07, 2017 06:40 AM by Eric Du
Sep 07, 2017 04:46 AM|syedshakeer|LINK
I am facing strange behavior while binding data to dropdownlist. I can see by putting break point Items have been added to DataSource. Once page loaded successfully no items were found in dropdownlist.
Here is my code.
ddl1.DataSource = liLanguagesReads;
ddl1.DataTextField = "Text";
ddl1.DataValueField = "Value";
Sep 07, 2017 06:40 AM|Eric Du|LINK
According to your description and code, I make a sample in my side, it works perfect, please check:
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
protected void Page_Load(object sender, EventArgs e)
DataTable table = new DataTable();
// Here we add five DataRows.
DropDownList1.DataSource = table;
DropDownList1.DataTextField = "Text";
DropDownList1.DataValueField = "Value";
Seeing from your code, I don't know the content of the variable liLanguagesReads and the font page code, so can not reproduce your issue, I hope you could post the complete code for us to test, also if you meet some exception message, please post out.