Click here to Skip to main content
12,635,428 members (25,565 online)
Click here to Skip to main content
Add your own
alternative version

Stats

85.3K views
5.7K downloads
24 bookmarked
Posted

Custom ASP.NET DropdownList Control Using Chosen jQuery Plugin

, 26 Oct 2015 CPOL
Rate this:
Please Sign up or sign in to vote.
Custom ASP.NET DropdownList control using chosen jQuery plugin

Introduction

The ASP.NET DropDownList is an easy way to offer a set of selections for the user. However, if you want to allow the user to enter information not available in the dropdown list, you will have to write your own JavaScript code or jQuery. This source code combines that work into an ASP.NET DLL control you can easily place on any ASP.NET web page.

The downloadable source project above uses the following technologies:

Example

Background

You do not need to have knowledge of jQuery, JavaScript, or CSS to use the DropDownListChosen. The only requirement is to drag and drop the DropDownListChosen control. The source code download contains the class library project for the DropDownListChosen and a test website using the DropDownListChosen control.

Using the Nuget-Package

You can now reference this project as a nuget package.

  • Install-Package DropDownListChosen

This will add necesary configuration for you, just add the control tag to your webform like this.

<asp:DropDownListChosen ID="DropDownListChosen1" runat="server" 
            NoResultsText="No results match." width="350px"            
            DataPlaceHolder="Type Here..." AllowSingleDeselect="true">                
        </asp:DropDownListChosen>
  1. Bind items to your dropdown list either manually by adding ListItems to the DropDownListChosen or by binding to a DataSource.
    Datasource example can be found in the downloadable source code above.

You're done! You can now work with your DropDownListChosen to find what options work best for you. I would love to hear some great feedback if you use this control on your site.

Also added a repository on github.

https://github.com/arbh89/DropDownListChosen

History

  • 13th July, 2013: Tip published
  • 7th August, 2013: Added DataPlaceHolder property and removed style sheet that causes design problems
  • 7th September, 2013: Added new properties AllowSingleDeselect and DisableSearchThreshold
  • 25 Octiber, 2015: Added as a Nuget Package

License

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

Share

About the Author

Angel Blandón
Software Developer Communications
Nicaragua Nicaragua
I am a ASP.Net Software Developer from Nicaragua.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionSearch option not displaying Pin
anuexuberant11-Sep-13 3:31
memberanuexuberant11-Sep-13 3:31 
AnswerRe: Search option not displaying Pin
Angel Blandón11-Sep-13 6:42
memberAngel Blandón11-Sep-13 6:42 
QuestionSelected item not working Pin
Member 102092289-Sep-13 6:56
memberMember 102092289-Sep-13 6:56 
AnswerRe: Selected item not working Pin
Angel Blandón9-Sep-13 8:27
memberAngel Blandón9-Sep-13 8:27 
QuestionZIP file broken? Pin
Member 1020758214-Aug-13 14:13
memberMember 1020758214-Aug-13 14:13 
AnswerRe: ZIP file broken? Pin
Angel Blandón14-Aug-13 18:14
memberAngel Blandón14-Aug-13 18:14 
GeneralRe: ZIP file broken? Pin
Member 1020758215-Aug-13 6:18
memberMember 1020758215-Aug-13 6:18 
GeneralRe: ZIP file broken? Pin
Member 1020758215-Aug-13 8:05
memberMember 1020758215-Aug-13 8:05 
Questionhow to use in MVC4 Pin
Mohit Jagtap10-Aug-13 3:22
memberMohit Jagtap10-Aug-13 3:22 
AnswerRe: how to use in MVC4 Pin
Angel Blandón10-Aug-13 7:13
memberAngel Blandón10-Aug-13 7:13 
Questionchanging the entire page design while adding DropDownListChosen dll Pin
shyamrashun6-Aug-13 19:52
membershyamrashun6-Aug-13 19:52 
AnswerRe: changing the entire page design while adding DropDownListChosen dll Pin
Angel Blandón7-Aug-13 5:07
memberAngel Blandón7-Aug-13 5:07 
GeneralRe: changing the entire page design while adding DropDownListChosen dll Pin
Member 103280719-May-14 15:10
memberMember 103280719-May-14 15:10 
QuestionLook and feel gets disturbed Pin
Member 911410726-Jul-13 19:36
memberMember 911410726-Jul-13 19:36 
I have download and tried the code. When we select any item from DropDownListChosen dropdown, the select index changed(DropDownListChosen1_SelectedIndexChanged) events gets fired and then on browser window the Look and Feel of the dropdown gets disturbed.

Am I missing something ?
Suggestionsource code Pin
techchallenger14-Jul-13 10:06
membertechchallenger14-Jul-13 10:06 
GeneralRe: source code Pin
arbh8914-Jul-13 10:14
memberarbh8914-Jul-13 10:14 
GeneralRe: source code Pin
techchallenger14-Jul-13 10:19
membertechchallenger14-Jul-13 10:19 
GeneralRe: source code Pin
Аslam Iqbal14-Jul-13 19:29
memberАslam Iqbal14-Jul-13 19:29 
GeneralRe: source code Pin
techchallenger15-Jul-13 3:13
membertechchallenger15-Jul-13 3:13 
GeneralRe: source code Pin
Аslam Iqbal15-Jul-13 19:19
memberАslam Iqbal15-Jul-13 19:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 26 Oct 2015
Article Copyright 2013 by Angel Blandón
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid