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

Rename node is not working properly on onNodeEditing event

3 Answers 103 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sampada
Top achievements
Rank 1
Sampada asked on 21 Aug 2012, 09:39 AM

Telerik team,

I am using OnClientNodeEditing event of radtreeview to rename the node. I am also updating the database from the client side.
I am getting a weird problem. Whenever I rename the node and after then any server side event gets call the node get the previous text i.e. the text which was before renaming.

I don't want to post back for simple action like renaming the node.
Please let me know the cause and resolution for such behavior of the radtreenode.

Any help will be appreciable.

Regards,
Sampada








3 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 22 Aug 2012, 08:08 AM
Hi Sampada,

Could you send the code for the OnClientNodeEditing event, so that we can get a better understanding of your logic in order to reproduce the issue.
 
All the best,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Sampada
Top achievements
Rank 1
answered on 22 Aug 2012, 11:12 AM
Following is my code to rename the radtreenode :

function trvNodes_onNodeEditing(sender, args) {
            var parent = new Telerik.Web.UI.RadTreeNode();
            parent = args._node.get_parent()
            var flag = true;
            var allNodes = parent.get_allNodes();
            
            if (args.get_newText().trim() == "") {
                flag = false;
                args.set_cancel(true);
            }
 
            if (flag) {
            //folowing method update the database entry from client side.
                RenameNode(args._node.get_value(), args.get_newText());
            }
        }

After renaming node if I add new node in treeview from server side.
The new node name went and old node name appears.
I am not rebinding radtreeview while adding node. 

0
Bozhidar
Telerik team
answered on 22 Aug 2012, 12:04 PM
Hi Sampada,

Try adding the following line in the beginning of the trvNodes_onNodeEditing function:
sender.trackChanges();

Then add a handler for the OnClientNodeEdited event and write the following line inside it:
function onClientNodeEdited(sender, args) {
    sender.commitChanges();
}

This should solve the issue.
 
Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Sampada
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Sampada
Top achievements
Rank 1
Share this question
or