RadTreeView control with TextBox Space issue

3 posts, 0 answers
  1. Sreenivas
    Sreenivas avatar
    12 posts
    Member since:
    Dec 2007

    Posted 18 Aug 2009 Link to this post

    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. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Aug 2009 Link to this post

    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.
  3. Sreenivas
    Sreenivas avatar
    12 posts
    Member since:
    Dec 2007

    Posted 21 Aug 2009 Link to this post

    This works great. Thank you so much.
Back to Top