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

F2 not enter edit mode

7 Answers 85 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Roiy
Top achievements
Rank 1
Roiy asked on 29 Jun 2008, 12:33 PM
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

7 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 01 Jul 2008, 12:37 PM
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
0
Roiy
Top achievements
Rank 1
answered on 01 Jul 2008, 01:14 PM
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;  
    } 
0
Accepted
Simon
Telerik team
answered on 01 Jul 2008, 01:43 PM
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
0
Roiy
Top achievements
Rank 1
answered on 01 Jul 2008, 02:09 PM
Thanks its work
0
Manoj
Top achievements
Rank 1
answered on 08 Jan 2009, 12:19 PM
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
0
Veselin Vasilev
Telerik team
answered on 08 Jan 2009, 12:54 PM
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.
0
Manoj
Top achievements
Rank 1
answered on 08 Jan 2009, 01:23 PM
Hi Veselin,
        Thanks , its work.
Regards
Manoj
Tags
TreeView
Asked by
Roiy
Top achievements
Rank 1
Answers by
Simon
Telerik team
Roiy
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or