Reputation: 2234
If you supply a list of strings to an edit control and set the autocomplete mode and source then you automatically get autocomplete functionality. My question is can I get the same functionality in .NET somewhere without a control. In other words I want something like:
string[] ProgressivePartialMatch( string[] Strings, string MatchText )
and so I want the strings back that would have showed up in the autocomplete, so to speak.
Upvotes: 3
Views: 221
Reputation: 24232
If you want fast autocomplete, you're going to want to implement a trie. You can find all the items that start with a particular string by following the trie down until the "starts with" string ends.
Upvotes: 1
Reputation: 86718
If it doesn't exist, it's easy to write yourself
string[] ProgressivePartialMatch(string[] Strings, string MatchText)
{
return Strings.Where(s => s.StartsWith(MatchText)).ToArray();
}
Upvotes: 0
Reputation: 14712
You can use ajax to get matched items from database (jQuery will fit your needs). And simple javascript (preferably jQuery) for edit control. The question is why you need this?
P.S. Take a look at this
jQuery Autocomplete and ASP.NET
Upvotes: 0