New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Space Is Ignored in Textbox Placed in ItemTemplate

PROBLEM

When you add a textbox to the ItemTemplate of RadListBox and start typing in it - the spaces are ignored.

SOLUTION

Add the following javascript code right after the listbox declaration:

var keyDown = Telerik.Web.UI.RadListBox.prototype._onKeyDown;
Telerik.Web.UI.RadListBox.prototype._onKeyDown = function (e) {
    if (e.keyCode == Sys.UI.Key.space) {
        return;
    }
    else {
        keyDown.apply(this, arguments);
    }
}    
In this article