1

Has anyone used jQuery to populate an autocomplete list on a textbox using ASP.NET webforms? If so, can anyone recommend a good method? From my reading so far, it seems like most people are using delimited lists rather than JSON to bring the items back. I'm open to any ideas that will get me up and running rather quickly.

1
  • I made a tutorial to do this with asp.net mvc but it should be almost identical for traditional webforms: blogs.msdn.com/joecar/archive/2009/01/08/… Commented Jan 8, 2009 at 7:40

1 Answer 1

1

There are many, many examples on the web. I've used this one before, and if I recall you only need to create an aspx that will return matching terms as a <BR/> separated list:

http://www.dyve.net/jquery/?autocomplete

The documentation shows php in the example, but there's no difference in the way the plugin itself works and I didn't have to do anything special as a result.

From the documentation:

> $("#input_box").autocomplete("my_autocomplete_backend.php");

In the above example, Autocomplete expects an input element with the id "input_box" to exist. When a user starts typing in the input box, the autocompleter will request my_autocomplete_backend.php with a GET parameter named q that contains the current value of the input box. Let's assume that the user has typed "foo"(without quotes). Autocomplete will then request my_autocomplete_backend.php?q=foo.

The backend should output possible values for the autocompleter, each on a single line. Output cannot contain the pipe symbol "|", since that is considered a separator (more on that later).

An appropiate simple output would be: foo fool foot footloose foo fighters food fight

Sign up to request clarification or add additional context in comments.

1 Comment

I had run across this one before, but was just wondering if there were any other commonly used plugins. This one works great, though. Thanks for the input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.