Hi!
I am using AutoCompleteBox and I would like to know how to get the very first value of the dropdown list (client side) with Javascript.
Thanks!
EDIT: I figured how to do this using the event dropDownItemDataBound in case someone else needs it:
var typed = "";
var current = "";
function requesting(sender, eventArgs) {
var acbox = $find('<%= RadAutoCompleteBox1.ClientID %>');
var acboxcontents = acbox.get_inputElement();
typed = acboxcontents.value;
}
function dropDownItemDataBound(sender, args) {
if (current != typed) {
if (typed.substr(typed.length-1, 1) == " ") {
var acbox = $find("<%= RadAutoCompleteBox1.ClientID %>");
var newEntry = acbox.createEntry(args.get_item().get_text(), args.get_item().get_text());
var entries = acbox.get_entries();
entries.add(newEntry);
current = typed;
typed = "";
}
}
}
Right after the client types a blank space (for instances "mysearch ") the code above gets the first value of the dropdown list, converts it into a token, ignores all the rest of the values in the list and clear up the typed string.
Now I just need to know how to set focus back to AutoCompleteBox... Telerik controls are like puzzles and everything is so hard to achieve. :(