简体   繁体   中英

ASP.NET dropdown to combobox

I have a Part Number field displayed as drop down list in my ASP.NET webform. User will select part number and System will store the respective ID from part table.

Since this is dropdown list, user is not able to type the part number. I want to use a combobox so that user can enter the initial few digits, and then suggestions will pop up like in a dropdown list. Also I want to show error is the entered value by user is not in the database.

I am currently using asp-for and asp-items tag helpers to show data in dropdown.

Is there a way I can get to display combobox instead of dropdown list?

Thanks!

The Answer to above question can be found here:

Link: How to get the values of multiple choose dropdown box

Add the jquery Script from above link. for Select tag, use class as: multiple class="chosen-select" and finally add below script to show default value when input doesn't exist in database.

<script>
$(".chosen-select").chosen({
  no_results_text: "Oops, nothing found!"
});


</script> 

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