Using the AutoCompleteExtender with a Web Service Method

If you prefer, you can retrieve the auto-complete suggestions from a separate web service instead of a page method. For example, the web service in Listing 39.2, the FileService web service, retrieves a list of matching filenames from the file system.

Listing 39.2. FileService.asmx

images

The web service in Listing 39.2 includes a web method named GetSuggestions() that returns a list of filenames that match the prefix text passed to the web method. A LINQ query is used to return the matching results.

The FileService class is decorated with a ScriptService attribute. This attribute is required ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.