Auto-complete
RadDropDownList provides flexible auto-completion options that suggest and append text from choices in the list as the user types.
AutoCompleteMode
The RadDropDownList.AutoCompleteMode property controls auto-complete behavior and can be set to None, Suggest, Append and SuggestAppend:
All auto-complete modes depend on the value of the Boolean CaseSensitive property.
- None: Nothing happens when a user begins to type into the text box part of the control. If the user types the whole text of an item and presses Enter, the item is selected.
Figure 1: AutoCompleteMode.None
AutoCompleteMode.None
- Suggest: As the user types an entry into the text box, the drop-down part of the control is shown, and the displayed items are filtered according to the entered text.
AutoCompleteMode.Suggest
Figure 2: AutoCompleteMode.Suggest
- Append: As the user types, the next item in the list that matches the user input is automatically appended to the characters the user has already typed. The drop-down list is not shown without the user clicking the arrow.
Figure 3: AutoCompleteMode.Append
AutoCompleteMode.Append
- SuggestAppend: Similar to the Append setting, but the drop-down list is shown and the suggested item is highlighted.
AutoCompleteMode.SuggestAppend
Figure 4: AutoCompleteMode.SuggestAppend
Auto-Complete Helpers
RadDropDownList internally uses auto-complete helpers to perform the auto-complete functionality.
* AutoCompleteSuggestHelper: it is created when the AutoCompleteMode property is set to AutoCompleteMode.Suggest or AutoCompleteMode.SuggestAppend. You can find below the AutoCompleteSuggestHelper's properties:
- SuggestMode: determines whether the items are auto-completed considering whether the text starts with or contains the searched text.
SuggestMode.Contains
Figure 5: SuggestMode.Contains
AutoCompleteDataSource: specifies the data structure to be bound.
AutoCompleteDisplayMember: specifies the particular field in the data source which will be used from the items in AutoCompleteSuggestHelper for their Text.
* AutoCompleteAppendHelper: it is created when the AutoCompleteMode property is set to AutoCompleteMode.Append or AutoCompleteMode.SuggestAppend. The LimitToList property controls whether the user is blocked to enter invalid string in the editable part.
Limit the user to enter only valid values
Customize auto-complete helpers
By default, the items displayed in the AutoCompleteSuggestHelper’s pop-up are sorted alphabetically. The following example demonstrates how to manipulate the sort order considering the item’s Text.Length property:
Custom comparer
Figure 6: Custom comparer