I encountered this space key issue when using textbox in treeview. every time when I hit space key in textbox, the checked node got unchecked and focus is lost. I follow the solution in http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-control-with-textbox-space-issue.aspx and it doesn't work. Here is my sample code.
<asp:Panel ID="cbpConditions" runat="server" Width="100%"> |
<telerik:RadTreeView ID="t" runat="server" Width="100%" CheckBoxes="True" OnClientNodeChecked="OnClientNodeCheckedEventHandler" |
OnClientMouseOver="OnClientMouseOver" OnClientNodeExpanded="NodeExpanded" ExpandDelay="0" MultipleSelect="false"> |
</telerik:RadTreeView> |
<script type="text/javascript"> |
var origOnKeyDown = Telerik.Web.UI.RadTreeView.prototype._onKeyDown; |
Telerik.Web.UI.RadTreeView.prototype._onKeyDown = function(e) { |
var node = this.get_selectedNode(); |
if (!node) { |
if (e.keyCode == this._upArrowKeyCode || e.keyCode == this._downArrowKeyCode || |
e.keyCode == this._enterKeyCode || e.keyCode == this._spaceKeyCode) { |
this._selectFirstNode(); |
//e.preventDefault(); |
} |
return; |
} |
origOnKeyDown.apply(this, arguments); |
} |
</script> |
</asp:Panel> |
The textbox is created in code behind instead of using template here.