Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a bounded DropDownList in my ASP WebForm.
it's bounded like this:
i tried to using JQuery (select2.js, dropdownsearchable.js) but nothing working!
any idea please?

What I have tried:

ASP.NET
<pre><div class="form-group">
                
                <asp:DropDownList  ID="myDDL" runat="server" CssClass="form-control" AutoPostBack="true" DataSourceID="MyDS" DataTextField="EName" DataValueField="AID"></asp:DropDownList>
                <asp:SqlDataSource ID="MyDS" runat="server" ConnectionString="<%$ ConnectionStrings:Conn %>" SelectCommand="NamesListSP" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
            </div>
Posted
Updated 3-Apr-19 8:34am
Comments
Richard Deeming 4-Apr-19 11:02am    
Show us what you've tried, and explain what "nothing working" means.

1 solution

You should not mix server-side implementation with client-side implementations. The standard ASP.NET DropDownList control is a server control and doesn't support search functionality out of the box. Here's what you can do:

If you want to implement server-side approach then you can try out: AJAX Control Toolkit ComboBox[^]

If you want to implement client-side approach, then use jQuery Autocomlete: AutoComplete DropDownList Alternatives In ASP.NET[^]. You can also use the jQuery Select2 as you mentioned.

There are plenty of examples on the web that demonstrate how to implement it. Just doa quick search at google about "DrodownList Autocomplete in ASP.NET" to get more examples.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900