Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Wednesday, October 11, 2006

CodeSnip: How to Create a Dynamic Searchable DropDown List in ASP.NET

In this article Nidal examines how to create a dynamic searchable dropdown list using ASP.NET.

Article Contents:

I have come across many situations where I found myself in need of providing the end user with a searchable combo box that returns the selected value to a text box.  An example of such a case is giving the end user the ability to select the name of a product from a long list.  ASP.NET does not provide the ability as a default control.  So, what I am going to do?


Suggested Design

One idea is to create your own control.  Note, I have seen some solutions on the web, however none of them satisfied my requirements.  Therefore, I took one and updated it to suit my needs.  I created a new popup window that takes the given parameters as to what to fill the box, as well as, the return control.



Obviously, you are eager to open your Visual Studio .NET 2003 and start coding.  So let us do it.

1.      Open Visual Studio .NET 2003, create a new ASP.NET website and give it a name: EDropDown.

2.      In the default form created, insert two labels and two HTML input boxes.

3.      Give the first label a text property My Product Name and the second one a text property My Employee Name.

4.      As for the two input boxes, put the ID property type TxtProductName and TxtEmployeeName in sequence.

By now we should have Figure 1 on the first form, the default start up design.

Post a Comment