Smart DropDownList

About ASP.net Smart DropDownList!

NOTICE(February 14 2006): There are a problem where including the SmartDropDown List control inside a user control. The ID of the User Control will be appended at the end of the control name, however the function will pass only the original ID name of the control. To fix that bug, I have changed the code below in C# or VB. Just build the dll with the new code and it should work fine in user control.

NOTICE(November 2005): I was told that the control does not work on C# projects. I have included in this page the source code in C# submitted by Tamara Dillard. Thanks to her, you can get the .cs code from the text area in this page and build the dll file.

NOTICE(April 2004):I have received some information that the control does not work correctly on VS.net 2003. Try downloading the source code and build the binary from scratch with VS.net 2003 and use the resulting binary instead. Sorry!

One of the most annoying thing with the ASP.net generic dropdownlist control is that when it is populated with tens or hundres of records, it will take a while to browse through the list. Most browser have a default action to select the first letter keyed by the user, however it does not go beyond the first letter. The Smart Dropdownlist lets the user to type in the whole word of his/her intended selection and it will automatically select the item. I have only tested this control IE 6 with client scripting enabled. The source code is available for modification and it is free to use. Hope this helps!

How to use Smart DropDownList?

Just simply download the source code in VB or C# provided below and build the binary (.dll) file.

To add the control to your Asp.net page:

1. If you use vs.net, just simply customize the toolbox and and add the
newly built dll file
. Just simply drag and drop SmartDropDownList control into your aspx pages.

2. If you use notepad simply add the register prefix at the beginning of your aspx page :

<%@ Register TagPrefix="cc1" Namespace="SmartDropDownList" Assembly="SmartDropDownList" %>

and add the control with this syntax:

<cc1:SmartDropDownList id="SmartDropDownList1" runat="server"></cc1:SmartDropDownList>

3. You can also use this for any regular static html, just simply add the script block shown below and add the javascript actions on the <SELECT> tag .

 

This control inherits all the properties, events, and methods of the generic Asp.net dropdownlist, therefore you can use it just like one. This control however will not work well if you set the dropdownlist to autopostback.

 

Demo

Just type the country you wish to select, the dropdownlist will choose the right item based on the letters you typed. Press backspace to start over.

 

Source Code for the SmartDropDownList Control (VB.net)

Source Code for the SmartDropDownList Control (C#)
Courtesy of Tamara Dillard. Special thanks!!!!

 

The client scripts generated by Smart DropDownList control
(you can use this in your static HTML page)


Author: Senjaya Tirtaputra
Email: senjaya@hotmail.com