I currently have a databound dropdown list on my ASP.Net C# 2.0 website that has around 400 items in it. I want to replace it with something similar like the textbox in google search where you enter letter and only the entries starting with those letters pop up
what is a good way of implementing it? Are there controls that already exists that anybody can suggest?
Press Alt + Q keys simultaneously to close the Microsoft Visual Basic Applications window. From now on, when click on a drop down list cell, the drop down list will prompt automatically. You can start to type in the letter to make the corresponding item complete automatically in selected cell.
Approach: Create a div with the class as a container. Inside of this div, create another div with a class as a text-container that will contain the <input> tag & <datalist> tag. Declare the list attribute as programmingLanguages inside the <input> tag.
When an item (option) is selected in DropDownList (HTML SELECT), the EnableDisableTextBox JavaScript function is executed. Inside this function, based on whether the Other option (item) is selected, the TextBox will be enabled else disabled. The HTML Markup consists of a DropDownList (HTML SELECT) and a TextBox.
One way to do this using HTML5 (for small datasets of course) is datalist
:
<input list="users" name="users">
<datalist id="users">
<option value="Alice">
<option value="Bob">
<option value="Chuck">
<option value="Chris">
<option value="Duke">
<option value="Emily">
</datalist>
For larger datasets AJAX is a better way to go.
Take a look at http://docs.jquery.com/Plugins/Autocomplete
Also here is a tutorial for use with ASP.Net
check complete.ly too
http://complete-ly.appspot.com/
it has no dependencies and weights very little.
If these are known enrties, you can use JQuery, and on the OnUpdate event:
Checkout the JQuery library for implementations on how to display the suggestion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With