sd_dracula
sd_dracula

Reputation: 3896

asp.net TextBox predictive text

I have a list of items which is a bit too large for a dropdownlist and I'd like to add a search textbox which based on the input will drop down a list of matching items.

So if you put in John the list below would display any items that start with John.

How to go about doing that?

Upvotes: 2

Views: 5175

Answers (2)

skub
skub

Reputation: 2306

Well what you want to look at is the autocomplete libraries that are available. In your case, ASP.NET AJAX control toolkit has this functionality.

There are other options such as :

Upvotes: 0

smartcaveman
smartcaveman

Reputation: 42256

The feature you are referring to is commonly labeled "AutoComplete".

If you are not at all familiar with how to do this, I would suggest following a tutorial or leveraging a pre-existing solution.

There is an example using the ASP.NET AJAX Control Toolkit available at: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx

The basic idea is that when input is changed, JavaScript will send an asynchronous HTTP request to the server and find out what the auto-complete items should be, then it will fill the drop down options with the returned values.

Upvotes: 4

Related Questions