This is a migrated thread and some comments may be shown as answers.

Space key issue when using textbox in treeview

2 Answers 124 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 27 Oct 2009, 01:23 PM
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.

2 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 29 Oct 2009, 11:49 AM
Hi Anthony,

Please try this code instead:

<script type="text/javascript">
   Telerik.Web.UI.RadTreeView.prototype._onKeyDown = function(e) { } 
</script>


Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sreenivas
Top achievements
Rank 1
answered on 05 May 2010, 08:47 PM
Hi,
This code works perfectly on my local dev machine. But after deploying to QA/DEV box its not working. As QA and DEV is using https. Do any body has this issuse. Please let me know asap.

Appriciate your help.

Thanks
Tags
TreeView
Asked by
Anthony
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Sreenivas
Top achievements
Rank 1
Share this question
or