Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A client side filtered dropdown for ASP.NET

0.00/5 (No votes)
12 Jul 2004 1  
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