views:

172

answers:

4

Can anybody tell me how can I implement something like the Stack Overflow tags autocomplete textbox, with Ajax?

+1  A: 

first you will have to create a webservice for retriving words

http://www.csharpcorner.com/UploadFile/raj1979/AutoComplete02142008113654AM/AutoComplete.aspx

Searock
+2  A: 

The easiest and simplest way is using the AutoCompleteExtender in the Ajax Controls Toolkit.

This uses a WebService to feed data to the control and can be linked to an existing TextBox. However you can also make use of a PageMethod to feed the extender.

Alternatively you can roll your own using JavaScript and the ScriptManager, however it can be quite tricky. I have recently tried with JQuery and it is definitely simpler.

Diago
Ajax Controls Toolkit is definitely easy to implement, however it generates really huge js files [typically .axd files seen in "view source"] compared to the jquery based ajax
Vikram
Agreed. However there is some methods to compress these files. JQuery is a better option but not all environments allow it's use. For example we are only allowed to use Asp.Net Ajax and not JQuery.
Diago
A: 

G'day,

I'd suggest getting a copy of the excellent book "Pragmatic Ajax" (sanitised Amazon link) which walks you through just such an example.

HTH

Rob Wells
+2  A: 

I would highly recommend looking at this jquery autocomplete plugin which i have used on several of my web projects with fantastic reviews from the customers.

Vikram
I believe that SO actually uses that plug-in. Well they did before they allowed wildcards. One of the latest posts on the SO blog talks about a new plug-in they are using.
Adam Pope