AutoComplete selected value?

Hi there, how do you get the selected value of an AutoComplete?
It seems I can only get the Text that was typed in the box. But I'm trying to get an Id value of a row loaded in the autocomplete's list of items. I was hoping it would work like a dropdown.
I see it has a ValueExpression property, but there's no documentation on it, it appears, and I can't tell what it does. I tried using the Change event a couple different ways:

  • ((args) => LoadSelectedItem(args))
  • LoadSelectedItem

But it's still giving me only the text that was typed -- not anything about the underlying selected item.
I could make it work if there were a int SelectedIndex property, for example. Just having the text that was typed in the box doesn't really help me, however.

The Value of the AutoComplete is always the text that the user typed or the value of the TextProperty of the selected item. Since the AutoComplete allows for custom values (not available in the suggestion box) it cannot provide the whole data item as a value. There is nothing to provide if the user entered some text which does not exist in the suggestions.

You have two options

  • just find the item by text e.g. var item = data.Where(o => o.Name == autoCompleteValue).FirstOrDefault()
  • Use RadzenDropDown with filtering. As long as you don't set ValueProperty you will get the "whole" data item as Value.

I agree if the user types something not in the list, there's no Value to return.
But if there is a certain item the user selected, I feel like that should be known.
The use case here is as a general-purpose search box.
In my case, I have many thousands of names, emails, and phone numbers. An AutoComplete is a good case for this rather than a dropdown.
If I search for "abbot", I get some results to appear. There are id numbers behind these results that I need. I think you're telling me there's no way to know what the user selected.
The value "abbot" is available in the event handler (what the user typed), but this doesn't uniquely identify something in the list. Do you know a better way to do what I'm trying to do?


My second reply is to try RadzenDropDown with filtering enabled.