简体   繁体   中英

drop down list selection based on 2 or more user input characters

I have a drop down list in an ASP.net C# aspx page that contains several items:

  • Avocado
  • Eggplant
  • Bananas
  • Beets
  • Broccoli
  • Radishes

I want to enable near searching so a user can input:

  • Ex1 - "Br" to get Broccoli instead of Radishes
  • Ex2 - "Be" to get Beets instead of eggplant
  • Ex3 - "Ba" to get Bananas instead of Avocado.

I recommend you use the ASP.NET AJAX AutoComplete extender. It extends an ASP.NET TextBox control and then uses an AJAX call to get the autocomplete (ie suggestions), based on the input the user provided in the text box.

Read Creating a Simple Auto-Complete TextBox for a tutorial-walkthrough of creating an autocomplete example.

Read ASP.NET AJAX Control Toolkit documentation for a demo and description of the other ASP.NET AJAX extenders.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM