Hi can someone help me. I added select2 to an asp.net app, but it’s not displaying the items that have been bound to the drop down. I set a break point on the drop down in the code-behind and I can see the values are their, but in the UI the drop down is empty when I expand it.
I’ve added the javascript and css references to my master page. Here is my aspx.
<asp:DropDownList ID="ddlManagers" runat="server" ClientIDMode="Static" CssClass="form-control"></asp:DropDownList>
Here is my code-behind where I populate and bind the drop down
var managers = db.users.Where(i => i.manager == true).Select(u => new { id = u.mgrUserId, manager = u.lname + ", " + u.fname }).ToList();
ddlManagers.DataTextField = "manager";
ddlManagers.DataValueField = "id";
ddlManagers.DataSource = managers;
ddlManagers.DataBind();
ddlManagers.Items.Insert(0, new ListItem("", ""));
I’d really appreciate some help in getting the values to actually display.
Thanks