2014-01-24 82 views
2

在下面的代码中有一个下拉菜单,其中有一些国家和我的目标是使下拉菜单可编辑和可搜索。请帮助我做到这一点。可搜索的下拉框

代码:

<label for='SelectCountry'>Choose a country:</label><br /><br /> 

    <asp:DropDownList id='SelectCountry' name='SelectCountry' runat='server' 
         ClientIDMode='Static'> 
     <asp:ListItem Text='Afghanistan' Value='Afghanistan'></asp:ListItem> 
     <asp:ListItem Text='Albania' Value='Albania'></asp:ListItem> 
     <asp:ListItem Text='Algeria' Value='Algeria'></asp:ListItem> 
     <asp:ListItem Text='Bahrain' Value='Bahrain'></asp:ListItem> 
     <asp:ListItem Text='Bangladesh' Value='Bangladesh'></asp:ListItem> 
     <asp:ListItem Text='Barbados' Value='Barbados'></asp:ListItem> 
     <asp:ListItem Text='Cambodia' Value='Cambodia'></asp:ListItem> 
     <asp:ListItem Text='Cameroon' Value='Cameroon'></asp:ListItem> 
     <asp:ListItem Text='Canada' Value='Canada'></asp:ListItem> 
    </asp:DropDownList> 

    <br/> 

    <script type='text/javascript' > 
     $(function() { 
      $('#SelectCountry').ufd({ log: true }); 
     });  
    </script> 

</asp:Content> 

回答

0

Select2是一个jQuery插件,让像搜索和显示图像设备,只需检查此链接:Select2 - DropDown

1

enter image description here
检索下拉以自动完成和过滤文字,刚刚经历链接为 Reference