Rename node is not working properly on onNodeEditing event

4 posts, 0 answers
  1. Sampada
    Sampada avatar
    44 posts
    Member since:
    Feb 2012

    Posted 21 Aug 2012 Link to this post

    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








  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 22 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sampada
    Sampada avatar
    44 posts
    Member since:
    Feb 2012

    Posted 22 Aug 2012 Link to this post

    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. 

  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 22 Aug 2012 Link to this post

    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.
Back to Top