I've got a working version of Autocomplete using the Ajaxcontroltoolkit. However, the service method signature is required to return a String[] to render the autocomplete suggestions in markup.
My service actually returns an object Foo that is made up of a string Image URL and a string Title (in JSON or XML).. anyone know of a way to have an Autocomplete accept an object instead of a string so that I can display the Image next to the title in the suggestion list?
You cannot do this natively with the control. The closest you could get is taking your Foo object and serializing that into something like http://myserver.com/images/myImage.jpg|myTitle
. Then on the client side, you could utilize the OnClientPopulated
and OnClientItemSelected
properties to parse the image and title and do a custom display.
You have the jQuery tag there, so are you also considering the use of jQuery UI's autocomplete? It is definitely capable of what you're wanting to do.