asp DropDownListChosen not showing any items in the dropdown

三世轮回 提交于 2019-12-12 16:10:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!