Click here to Skip to main content
15,883,705 members
Articles / Web Development / HTML
Article

A client side filtered dropdown for ASP.NET

Rate me:
Please Sign up or sign in to vote.
1.83/5 (6 votes)
12 Jul 20041 min read 51.7K   2K   15   4
Filter a combo box in IE as you type - without posting back at every key press

Sample Image - FilteredDropDownList.jpg

Introduction

Internet Explorer's combo box does not have enough functionality. This is one attempt at giving your site users a better experience, especially if combo boxes are related to each other and need to post back, or if your lists are very long, or even unsorted. It can be an irritating experience for the user to scroll up and down for minutes looking for a value to pick.

Using the code

The code is pretty self explanitory, and uses some javascript for client side work. Compile the FilteredDropDownList class into a web control library, and use it like you would use a normal ASP.NET DropDownList, from which the control inherits.

The ValueStartsWithFilterString property indicates if the text typed must be at the start of the text in the combo box, or anywhere in the combo box item’s text. The TextCSSClass property sets the stylesheet class of the textbox where the filter string is typed. The Text property sets the text in the textbox where the filter string is typed.

Points of Interest

This control is for use with Internet Explorer, some other browsers, like FireFox, already have this functionality in their combo boxes. The code was only tested using Internet Explorer 6.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralControls works flawlessly Pin
frmaheu21-Jan-09 5:38
frmaheu21-Jan-09 5:38 
GeneralDoesn't Work Properly Pin
jmagi16-Oct-05 14:42
jmagi16-Oct-05 14:42 
Questionhow to filter dataset in client Pin
jiataiping13-Jun-05 16:51
jiataiping13-Jun-05 16:51 
GeneralA low vote... Pin
Paul Watson17-Jul-04 3:35
sitebuilderPaul Watson17-Jul-04 3:35 

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.