Intellisense/Typeahead DropdownList

  • Thread starter Thread starter Tammy
  • Start date Start date
T

Tammy

Hi,

Can anyone tell me how to implement the following:

I have a dropdownlist containing:

abcde
alpha
amino


When a user clicks on the dropdownlist and types "ami", I want it to
go to amino. Currently, you can only type in a.

Thanks for any help.
 
Tammy,

You would have to do a number of things. First, you would have to
establish the threshold that you would wait before you determined that the
person has stopped typing. Basically, you want to say "if a keyclick comes
..1 seconds or more after the last, then it is not part of the same word".

Once you determine that value, once you detect the first keypress, you
would append the character to the end of a string that you have stored.
Then, you would find the item in the list that most closely resembles that
string. You also need to keep a timestamp of the last time a key was
pressed.

When the event handler for the next keypress is fired, you need to check
the current timestamp against the old timestamp. If it is over your
previously defined threshold, then clear your search buffer. Then, append
the character to the end of the buffer (which might now be cleared), and
begin your search again.

Hope this helps.
 
Yes, this could be annoying to implement.

But that's why "Off the shelf components" exist.
Why spend a whole day implementing an auto-complete drop down, when there
are literally dozens available to buy
on http://www.componentsource.com

this comes back to my whole question of the best grid component.

Anybody got any input on that????

Nicholas Paldino said:
Tammy,

You would have to do a number of things. First, you would have to
establish the threshold that you would wait before you determined that the
person has stopped typing. Basically, you want to say "if a keyclick comes
.1 seconds or more after the last, then it is not part of the same word".

Once you determine that value, once you detect the first keypress, you
would append the character to the end of a string that you have stored.
Then, you would find the item in the list that most closely resembles that
string. You also need to keep a timestamp of the last time a key was
pressed.

When the event handler for the next keypress is fired, you need to check
the current timestamp against the old timestamp. If it is over your
previously defined threshold, then clear your search buffer. Then, append
the character to the end of the buffer (which might now be cleared), and
begin your search again.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Tammy said:
Hi,

Can anyone tell me how to implement the following:

I have a dropdownlist containing:

abcde
alpha
amino


When a user clicks on the dropdownlist and types "ami", I want it to
go to amino. Currently, you can only type in a.

Thanks for any help.
 
Back
Top