A feature I am adding to dashCommerce is an AutoComplete feature to the Order Search, which will allow you to type in the first few characters of an order number and the AutoComplete feature will bring up a list of possible order numbers.

The problem I ran into while prototyping the work is related to the fact that dashCommerce order numbers are numeric strings. For example: 0123-4567-8901-2345. We did this because for our international friends, order numbers such as 09UIY79T6R$NHG would not be too helpful. :)

I am using an AJAX-enabled WCF Service as the endpoint and so I had the following code in my FindOrder method:

      list.Add("0234-5678-901");
      list.Add("1123-4567-890");
      list.Add("1234-5678-901");

The interesting behavior that occurs when trying to get this to work is that the results are kinda funky:

AutoComplete_Hurumph

Not exactly the anticipated result. :) But, there is a way to get this to work as expected. For each item you add to the list, you need to add the item to the IList<T> as:

list.Add(AutoCompleteExtender.CreateAutoCompleteItem("0123-4567-890", "0123-4567-890"));

That’s ok, but not exactly great as now my service has some “UI junk” in it. I’m not entirely sure I care right now, as the service is exposed for a particular feature, but this seems to me to be – hmmm – less than good. But, once the change is made, the result is a bit better:

AutoComplete

I only changed the first one for the demo. I hope this helps someone else who encounters the problem.

DotNetKicks Image