AutoComplete or Suggest Control for Ajax.NET

I have a new demo at http://munich.schwarz-interactive.de/autocomplete.aspx which will use a textbox and Ajax.NET Professional to search for customer names (1st textbox) and then for the orders of this selected customer (2nd textbox).

There is a big difference to other AutoComplet boxes. You can use any AjaxMethod to do your search. There is an example done with returning DataSets, default would be something like string[] (arrays). The second textbox is using the CustomerID from the first textbox, not the CustomerName. This is also very different to other controls. If you have a look in the source code you will find both controls and how they are rendering the lines.

I didn't test the control in all browsers, IE and Firefox should work.

Would be nice to get some feedback!!  ;)

Published Thursday, May 18, 2006 3:19 PM by Michael Schwarz

Comments

# re: AutoComplete or Suggest Control for Ajax.NET

Thursday, May 18, 2006 10:00 AM by Chris
where is the source for this located at?

Thanks!!

# re: AutoComplete or Suggest Control for Ajax.NET

Thursday, May 18, 2006 10:12 AM by Michael Schwarz
You can use right-click, view source to get the source of the html code. The autocomplete.js is in folder /scripts, so you can download it directly.

Do you need the server-side code, too?

# re: AutoComplete or Suggest Control for Ajax.NET

Thursday, May 18, 2006 11:03 AM by zonker
I like it but one thing I noticed...while viewing the suggested order numbers, clicking on an entry in the drop-down box did not place the entry in the textbox. I know that it will get entered if I use the TAB key, but I think users should be able to click on the entry. Just a little nit-picking.

;-)

Very helpful functionality.

# re: AutoComplete or Suggest Control for Ajax.NET

Thursday, May 18, 2006 11:28 AM by Michael Schwarz
Yes, of course, I will add mouse support. I wrote this small script in some minutes, so please wait until the next days... ;)

# re: AutoComplete or Suggest Control for Ajax.NET

Friday, May 19, 2006 8:04 AM by John
Hey

Is it possible to download the source, the server-side code aswell.

Thanks

# re: AutoComplete or Suggest Control for Ajax.NET

Friday, May 19, 2006 9:06 AM by Michael Schwarz
The download will be included in the next release of the starter kit... Hopefully I can get this end of this week already.

# re: AutoComplete or Suggest Control for Ajax.NET

Saturday, May 20, 2006 4:57 AM by Vincent
What I find very good at this version of an Autocomplete/suggest, is that when there's an entry that matches, you don't fill up the while textbox with it. The user has to actually select the entry (unlike Google suggest for example).

Which allows for example to return all sorts of matching results. Like, if you type 'New' you could get 'New York' and 'Something new' as a result.

So it is actually more of a suggest (an assisted search), instead of a real autocomplete.

Great job. Well, no wonder, as it comes from the same guy who wrote AJAX.NET :-)

# re: AutoComplete or Suggest Control for Ajax.NET

Monday, May 22, 2006 4:47 PM by AJAX.Pro Fan
If you resize the window, the DIV with all possible choices is visible where the text box was located before I re-sized it.

# re: AutoComplete or Suggest Control for Ajax.NET

Tuesday, May 23, 2006 2:45 AM by Adrian Tanase
Great stuff. However :) there is another small issue with the keyboard support.

After I select something and I'm still in the input field, pressing up and down still cycles through the hidden options, so when I TAB out of the control the selected value changes.

# re: AutoComplete or Suggest Control for Ajax.NET

Thursday, May 25, 2006 2:23 PM by Vince
built my own page and got this:

Microsoft JScript runtime error: Object doesn't support this property or method

MS.Position.setBounds(this.div, r);

# re: AutoComplete or Suggest Control for Ajax.NET

Friday, June 02, 2006 3:51 AM by farhan
can we not do it like gmail. e.g if there is a name in a database peter scott n on the field when we write 'p' drop down list containing peter scott is visible also if we write just 's' for scott same drop down lost containing 'peter scott' comes visible.

# re: AutoComplete or Suggest Control for Ajax.NET

Friday, June 02, 2006 5:31 PM by Michael Schwarz
Yes, of course you can do this. JavaScript code is available and you have to return the list you want to see. It is not a Ajax.NET behaviour, it is the method which will return the items.

# re: AutoComplete or Suggest Control for Ajax.NET

Monday, June 05, 2006 11:03 AM by abdul
Great Job .. (y)

# re: AutoComplete or Suggest Control for Ajax.NET

Monday, June 12, 2006 10:24 AM by oren
I am getting an error if I link autocomplete.js using:
<script type="text/javascript" src="scripts/autocomplete.js"></script>

The error I am getting is in the first line inside autocomplete.js:
addNamespace("MS.Web.AutoComplete");

and the error message is:
'Object Expected'

Any ideas ?

# re: AutoComplete or Suggest Control for Ajax.NET

Monday, June 26, 2006 6:02 AM by Thomas Nystrøm
I have the same problem as oren with the error in the first line inside autocomplete.js:
addNamespace("MS.Web.AutoComplete");

why ?

# re: AutoComplete or Suggest Control for Ajax.NET

Sunday, July 09, 2006 1:13 PM by Augusto Valero
I have IE 6.0 and net.2.0 and it does not work. Can anyone help me ?

# re: AutoComplete or Suggest Control for Ajax.NET

Tuesday, July 11, 2006 5:23 PM by Sinthuja Jeyachanderan
Try using the