How to prevent the dropdown list from moving between last to first and first to last element in AutoCompleteBox's popup?

0 Answers 69 Views
AutoCompleteBox
Kamil
Top achievements
Rank 1
Iron
Kamil asked on 05 Jan 2022, 12:28 PM

I've created  AutoCompleteBox in code behind and I'm using AutoCompleteBox.DataSourceSelect to get suggested values into a dropdown. By using up & down arrow keys I can move through the suggest list.

When I'm at:
- the last element in the list and I'm pressing down arrow key I do not want the list to go back to the first element - I want the list to stop at the last element no matter what,
- the first element in the list and I'm pressing up arrow key I do not want the list to go back to the last element - I want the list to stop at the first element no matter what.

How can I implement this 'prevention' in the OnClientLoad() event?

Here's a fragment of my code:

var autoCompleteBox = new Telerik.Web.UI.RadAutoCompleteBox
{
	AllowCustomEntry = true,
	AutoPostBack = false,
	Delimiter = ",;\n",
	DropDownPosition = Telerik.Web.UI.RadAutoCompleteDropDownPosition.Static,
	EnableClientFiltering = false,

	Filter = Telerik.Web.UI.RadAutoCompleteFilter.StartsWith,

	HighlightFirstMatch = true,
	InputType = Telerik.Web.UI.RadAutoCompleteInputType.Token,

	MinFilterLength = 0,
	MaxResultCount = 100,	
};

autoCompleteBox.OnClientEntryAdded = "AutoCompleteBox_OnClientEntryAdded";
autoCompleteBox.OnClientRequesting = "AutoCompleteBox_OnClientRequesting";
autoCompleteBox.OnClientLoad = "AutoCompleteBox_OnClientLoad";	


No answers yet. Maybe you can help?

Tags
AutoCompleteBox
Asked by
Kamil
Top achievements
Rank 1
Iron
Share this question
or