AutoComplete Extender Troubleshooting

One of my tasks in our last release was to create a search box for a large value tree. For the implementation we (my team leader Doron and I) decided to use the AutoComplete extender from the Ajax Control Toolkit.
While implementing, we ran into a couple of problems, and I want to share with you the solution we found for each.

Problem: left-to-right input

I want the completion list to be right-to-left (for Hebrew input).

Solution

Set the CompletionListItemCssClass and CompletionListHighlightedItemCssClass with a custom CSS classes. In both CSS classes insert the following attribute:

text-align:right;  

DO NOT set this attribute in the CompletionListCssClass. It will cause the completion list to indent unexpectedly.

Problem: Error indication when accessing the auto complete web service

When an error occurs in the completion list web service, there is no indication for it.

Solution

Our solution was pretty simple: Warp the web service method content with try-catch and log the error. You can use other solutions (like AOP with attribute on the method), but this is only a partial solution.
In all solutions, the client has no idea that an error occurred. The only indication for it is that the completion list does not appear. I hope this will be fixed in the upcoming versions.

Problem: Key per value

I wanted each item to have a key assign to each value.

Solution

This was not possible in the earlier versions of the toolkit. Today this is possible, be using the the OnClientItemSelected event. For the complete solution, read thorugh this article

That's about it.

P.S.: Shani and his team made the usage of the web service for the AutoComplete more generic. I will be very grateful if he will add a couple of word about it (That means that you, Shani are tagged. Have fun)

Yossi Shmueli

Keeping it green since 1995

comments powered by Disqus