问题
I've currently added chosen jquery plugin to my asp project via nuget.
Install-Package DropDownListChosen
then in one of the aspx page I've used the dropdown as
// asp conent page
<asp:DropDownListChosen ID="listBoxAddress" runat="server"
NoResultsText="No results match." Width="350px"
DataPlaceHolder="Type Here..." AllowSingleDeselect="true">
</asp:DropDownListChosen>
// code behind
public void GetAddress()
{
try
{
DataTable dt = new DataTable();
listBoxAddress.ClearSelection();
listBoxAddress.Items.Clear();
DAL_Customer_Registration objDAL = new DAL_Customer_Registration();
dt = objDAL.Get_Address();
foreach (DataRow row in dt.Rows)
{
listBoxAddress.Items.Add(new ListItem(row["ADDRESS"].ToString(), row["ID"].ToString()));
}
}
catch (Exception) { }
}
In my master page I've added the .css of the chosen plugin
<link rel="stylesheet" media="screen,projection" type="text/css" href="~/chosen.css" />
But still the items of the dropdown are not showing. Why is it so? What is wrong with my process? What else references should I have to add in master page or asp content page? As suggested, I've already installed the dependencies jquery files still I am getting error as "Uncaught TypeError: this.container.find(...).first is not a function
" in the chosen.jquery.js file.
Is there any mistake with my code? Please suggest the possible solutions. Thanks!!!
来源:https://stackoverflow.com/questions/41395275/asp-dropdownlistchosen-not-showing-any-items-in-the-dropdown