F2 not enter edit mode

8 posts, 1 answers
  1. Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 29 Jun 2008 Link to this post

    Hi
    I have a rad tree with allowEdit = true, I add this line of code
    protected override void OnInit(EventArgs e)  
            {  
                base.OnInit(e);  
                RadTreeView1.NodeClick += new Telerik.Web.UI.RadTreeViewEventHandler(RadTreeView1_NodeClick);  
            } 
    Now, if I select a node and press the F2 key the node doesn't enter an edit mode.but if I select a node and click on it second time the node enter a edit mode.
    If i remove "RadTreeView1.NodeClick +=..." F2 work fine.

    any idea or work around to solve it will be great because I have to use nodeClick

    Thanks
    Roiy
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 01 Jul 2008 Link to this post

    Hello Roiy,

    I was unable to reproduce this behavior.

    Please examine the attached project.

    Do you find any differences from your implementation?

    Greetings,
    Simon
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 01 Jul 2008 Link to this post

    HI

    you need to add :
    this.Radtreeview.nodeClock+= new .....
    find below your code, i add the click code line and now after the click f2 not working
    please test it again with the click line

    thanks
    Roiy

    protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
     
            this.RadTreeView1.NodeEdit += new Telerik.Web.UI.RadTreeViewEditEventHandler(RadTreeView1_NodeEdit);  
            this.RadTreeView1.NodeClick += new Telerik.Web.UI.RadTreeViewEventHandler(RadTreeView1_NodeClick);  
        }  
     
        void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)  
        {  
        }  
     
        void RadTreeView1_NodeEdit(object sender, Telerik.Web.UI.RadTreeNodeEditEventArgs e)  
        {  
            e.Node.Text = e.Text;  
        } 
  4. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 01 Jul 2008 Link to this post

    Hi Roiy,

    F2 does not work in this case because the TreeView does not have the focus when the page loads after the NodeClick event.

    You can workaround this by giving the focus to the TreeView's div element with the following JavaScript function:

            function pageLoad() 
            { 
                var tree = $find("<%= RadTreeView1.ClientID %>"); 
                 
                if (tree.get_selectedNode()) 
                { 
                    tree.get_element().focus(); 
                } 
            } 

    Sincerely yours,
    Simon
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 01 Jul 2008 Link to this post

    Thanks its work
  6. Manoj
    Manoj avatar
    75 posts
    Member since:
    Dec 2008

    Posted 08 Jan 2009 Link to this post

    Hi Roiy,
        Can tell me from where you have call the


    function pageLoad() 
            { 
                var tree = $find("<%= RadTreeView1.ClientID %>"); 
                 
                if (tree.get_selectedNode()) 
                { 
                    tree.get_element().focus(); 
                } 
            } 

    Also tell me whether the below mentioned code is required or not ?

     this.RadTreeView1.NodeEdit += new Telerik.Web.UI.RadTreeViewEditEventHandler(RadTreeView1_NodeEdit);  
            this.RadTreeView1.NodeClick += new Telerik.Web.UI.RadTreeViewEventHandler(RadTreeView1_NodeClick);  

    Regards
    Manoj
  7. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 08 Jan 2009 Link to this post

    Hi Manoj,

    You need to put the pageLoad method in the <script> tag on your ASPX page. This method executes after all the controls are loaded and initialized on the page.

    The other two lines of code you need to use if you want to subscribe to the NodeEdit and NodeClick events of the treeview in code behind.

    Regards,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Manoj
    Manoj avatar
    75 posts
    Member since:
    Dec 2008

    Posted 08 Jan 2009 Link to this post

    Hi Veselin,
            Thanks , its work.
    Regards
    Manoj
Back to Top