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

RadTreeView control with TextBox Space issue

2 Answers 136 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sreenivas
Top achievements
Rank 1
Sreenivas asked on 19 Aug 2009, 03:07 AM
Hi,

I am having problem in using TextBox inside RadTreeView control with the Space.
This text box is accepting space but I have to click two times. Very first time its focusing to the RadTreeView and second one will be for space. Is there any way to get the space on first click?.

We are using Q1 2009 version of Teleriks controls for ASP.NET.

Sample page below..

<

 

telerik:RadTreeView ID="EntityListView" runat="server" CheckBoxes="true" EnableTheming="false"

 

 

Skin="Vista">

 

 

<NodeTemplate>

 

 

<asp:TextBox ID="tb" runat="server" Width="200px"></asp:TextBox>

 

 

</NodeTemplate>

 

 

<Nodes>

 

 

<telerik:RadTreeNode Text="Software" Expanded="true">

 

 

<Nodes>

 

 

<telerik:RadTreeNode Text="Business &amp;amp; Office" />

 

 

<telerik:RadTreeNode Text="Database" />

 

 

<telerik:RadTreeNode Text="Networking" />

 

 

<telerik:RadTreeNode Text="Presentation" />

 

 

<telerik:RadTreeNode Text="Project Management" />

 

 

<telerik:RadTreeNode Text="Reports" />

 

 

<telerik:RadTreeNode Text="Spreadsheet" />

 

 

<telerik:RadTreeNode Text="Word Processing" />

 

 

</Nodes>

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

<CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>

 

 

<ExpandAnimation Duration="100"></ExpandAnimation>

 

 

</telerik:RadTreeView>

 




Thanks
Sreenivas Jakkula

2 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 21 Aug 2009, 03:00 PM
Hello Sreenivas,

You can add the following javascript code after the treeview's declaration:

<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> 


Sincerely yours,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sreenivas
Top achievements
Rank 1
answered on 21 Aug 2009, 03:42 PM
This works great. Thank you so much.
Tags
TreeView
Asked by
Sreenivas
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Sreenivas
Top achievements
Rank 1
Share this question
or