After successfully implementing an autocomplete textbox using AJAX Autocomplete, I decided to enhance the feature with some Fuzzy logic. Now, as the user enters 3 characters, my database returns a list of records that match those characters.
The search results are refined based on the input provided by the user, creating a progressively shorter and more accurate list.
Using the included CSS class of the Autocomplete control, I customized the background color and selected item color in the extended textbox.
<asp:AutoCompleteExtender
ID="TextBox1_AutoCompleteExtender"
runat="server"
DelimiterCharacters=""
Enabled="True"
EnableCaching="True"
ServiceMethod="GetCompletionList"
ServicePath="~/search/strngSrch.asmx"
TargetControlID="TextBox1"
UseContextKey="True"
CompletionSetCount="30"
CompletionInterval="10"
MinimumPrefixLength="2"
CompletionListItemCssClass="itemHighlighted"
CompletionListHighlightedItemCssClass="itemHighlighted1">
</asp:AutoCompleteExtender>
Now, I am looking to change the text color only in each string (list item) that matches what the user has entered after typing 3 or more characters.
Despite searching for a solution online for 2 days, I have been unable to find something similar, leading to frustration.
For example, if a user enters "fish," the results list should appear like this:
Fishing (The 4 letters = to Fish should be red in each of these list items)
New Fishing licenses
Renew Fishing License
Fish and hatchery lists
If you have any links or solutions similar to what I described, I would greatly appreciate your help.
This functionality can be likened to searching for a specific text string in a PDF where the word is highlighted yellow in each occurrence within the document. I am open to changing either the background of the text entered by the user or changing the text color itself.
Thank you,