Here we've got a jQuery selector binding the autocomplete function to the searchTerm input box("#searchTerm"). ¬†We then set the URL for the source for the autocomplete suggestions, which in this case, will be our controller (Search) and action method (AutocompleteSuggestions). ¬†Then we set the number of characters the user has to type before we make the first call. ¬†It's set to three here to prevent pulling back meaningless matches from searching too soon.
Finally, we set up the autocomplete function's select event to set the selected value from the dropdown list as the value in the searchTerm input box and submit the form to the Search controller and the ProcessTheForm action method.
Now you need to write something that will return the records that match what the user has entered so far. ¬†This might be a database call with a LIKE searchTerm + "%" (watch out for SQL injection, though) or SOUNDEX or a web service call. ¬†Be sure you limit your returned search results to maybe the top 10 matches so you don't bog things down with too much data moving over the wire.
Next, set up a controller action to invoke this back-end call and JSON up the returned list. ¬†We've already names the controller (Search) and action (AutocompleteSuggestions) in our view. ¬†Something like this should work, where _searchRepository is my repository call that finds matching strings, which are then converted to JSON:
public JsonResult AutocompleteSuggestions(string term)
¬† ¬† var suggestions = _searchRepository.GetAutoCompleteSearchSuggestion(term);