<telerik:RadComboBox runat="server"
ID="RadComboBox1"
AllowCustomText="true" EmptyMessage=""
Width="85%"
EnableEmbeddedSkins="false"
DataTextField="Code" DataValueField="Id"
RenderMode="Lightweight"
ToolTip="Impact is Required"
MarkFirstMatch="True"
OnClientLoad="window.utility.Cbo.onClientLoad">
JS code part:
(function () {
'use strict';
//The namespace
window.utility = window.utility || {};
// ComboBox
window.utility.Cbo = window.utility.Cbo || {};
window.utility.Cbo.onClientLoad = function (sender) {
$telerik.$("#" + sender._inputDomElement.id).on('keyup',
function (e) {
if (e.keyCode == 8) {
var combo = $find(sender._uniqueId.split('$').join('_'));
if (!combo || !this.selectionStart || this.selectionStart <= 0)
return;
var caretPosition = this.selectionStart
var comboText = combo.get_text();
if (comboText || comboText.length > 0) {
var newComboText = comboText.slice(0, caretPosition - 1)
+ comboText.slice(caretPosition);
combo.set_text(newComboText);
--caretPosition;
this.selectionStart =
(caretPosition < newComboText.length)
? (caretPosition >= 0) ? caretPosition : 0
: newComboText.length - 1
this.selectionEnd = this.selectionStart;
}
}
})
}
})();
ASP.NET Telerik Combo Box control issue with backspace