locked
installed chosen plugin but using DropDownListChosen shows not a known element RRS feed

  • Question

  • User364607740 posted

    I installed the chosen plugin via nuget package as mentioned in the site 

    https://www.nuget.org/packages/chosen/

    But when I tried using it as ::

     <asp:DropDownListChosen ID="DropDownListChosen1" runat="server" 
                NoResultsText="No results match." width="350px"            
                DataPlaceHolder="Type Here..." AllowSingleDeselect="true">                
    </asp:DropDownListChosen>

    Element 'DropDownListChosen' is not a known element. This can occur if there is a compilation error in the website or the web.config file is missing.

    I am using this plugin inside asp:Content i.e. I am using MasterPage. Please suggest how can I resolve this problem.

    Thursday, December 29, 2016 11:18 AM

All replies

  • User-271186128 posted

    Hi scala_1988,

    To use the DropDownListChosen, you will need to follow these steps:

    1. Install the Nuget Package 
      • Install-Package DropDownListChosen
    2. Add the control tag in your webform:
    <asp:DropDownListChosen ID="DropDownListChosen1" runat="server" 
                NoResultsText="No results match." width="350px"            
                DataPlaceHolder="Type Here..." AllowSingleDeselect="true">                
            </asp:DropDownListChosen> 

    More details, see: https://github.com/arbh89/DropDownListChosen

    Best regards,
    Dillion

    Friday, December 30, 2016 3:18 AM
  • User364607740 posted

    I did not understand what you said.

    Add the control tag in your webform:
    <div class="highlight highlight-text-html-basic">

    I've already installed the package via nuget. I downloaded the code from github, and there was no such div class as you mentioned either in the master page or in the aspx page. Please clarify how can I solve this problem. 

    Friday, December 30, 2016 4:34 AM
  • User-271186128 posted

    Hi scala_1988,

    I did not understand what you said.

    Add the control tag in your webform:
    <div class="highlight highlight-text-html-basic">

    It is my fault, I didn't see it add a div outside the web form code after rendering. I have modified it.

    In my previous reply, I just want you to check the package reference. From the link, it seems that we should use "DropDownListChosen", instead of "chosen". You could check it.

    Best regards,
    Dillion

    Friday, December 30, 2016 6:33 AM
  • User364607740 posted

    I've already added the 'DropDownListChosen', via nuget. 

    My code ::

    // aspx code
     <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_Patient_Registration objDAL = new DAL_Patient_Registration();
                    dt = objDAL.Get_Address();
                    listBoxAddress.DataSource = dt;
                    listBoxAddress.DataTextField = "ADDRESS";
                    listBoxAddress.DataValueField = "ID";
                    listBoxAddress.DataBind();
                }
                catch (Exception) { }
            }

    I've also added .css file to the master page ::

    <link rel="stylesheet" media="screen,projection" type="text/css" href="~/chosen.css" />
    

    But the drop down is showing nothing, why is this ? Did I need to any other files to my master page or aspx page?

    Friday, December 30, 2016 9:45 AM