Google like a dropdown when a user searches

I am using asp.net C # 2008, and I need to create a search text box that will display outliers (similar to google search); The values ​​displayed in the drop-down list will be the values ​​from the SQL 2005 database (for example, the user searches by the first name, the first names will be displayed in the drop-down list, which will be filtered as the user types more letters ... if the user searches for LastName, in the drop-down list all LastName values ​​in the database are displayed, etc.)

Any ideas how to solve this problem?

+4
source share
5 answers

You are looking for an Auto Complete text box for a text box. I suggest using a ready-made solution for the jQuery plugin.

http://docs.jquery.com/Plugins/Autocomplete

+7
source

I would recommend checking the implementation of the ASP.NET AJAX Control Toolkit if AutoComplete control . After installing the toolkit, you can extend the standard ASP WebForm TextBox control to use it.

+2
source

This is an ASP.NET specific solution. Microsoft implemented this in the Ajax Control Toolkit (autocomplete control). Here's a working example:

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

But make sure you understand how it works internally (using Ajax calls), don't just blindly use controls.

+1
source

javascript is your answer. about 150 ms after pressing a key, send a request to your website for the corresponding values. Just be prepared to refuse it if the user types a different letter. There is very little point in trying to answer after every keystroke.

0
source

There is no built-in server management for this. You must implement your own.

Take a look at jQuery AutoComplete and try to implement it with Ajax callbacks.

0
source

Source: https://habr.com/ru/post/1303040/


All Articles