RadTreeView node.startEdit and Server Code

4 posts, 1 answers
  1. orim
    orim avatar
    29 posts
    Member since:
    Mar 2012

    Posted 16 Oct 2013 Link to this post

    Hi,
    i have a radtreeview with contextmenu. In javascript i execute following

    function onClientContextMenuItemClicking(sender, args) {
     
        selectedoption = args.get_menuItem().get_value();
        selectednode = args.get_node();
     
        menuItem = args.get_menuItem();
        treeNode = args.get_node();
        menuItem.get_menu().hide();
     
     
        switch (menuItem.get_value()) {
     
            case "FsFolder-Create":
                //treeNode.startEdit();
                //args.set_cancel(true);
                //radprompt('Enter Node Name', promptCallBackFn);
     
     
                var treeFs = $find('ctl00_MainContent_RadTreeViewFileShare');
                treeFs.trackChanges();
                var newNode = new Telerik.Web.UI.RadTreeNode();
                newNode.set_value(2);
                newNode.set_text('New Folder (' + (treeNode.get_nodes().get_count() + 1) + ')');
                newNode.set_imageUrl('../Content/Images/TreeView/FolderAllow.png');
                treeNode.get_nodes().add(newNode);
                treeNode.set_expanded(true);
                newNode.startEdit();
               // treeFs.commitChanges();
               args.set_cancel(true);
                break;
     
            case "FsFolder-Rename":
                treeNode.startEdit();
                args.set_cancel(true);
                break;
                 
     
            case "FsFolder-Delete":
                if (!clickCalledAfterRadconfirm) {
                    args.set_cancel(true);
                    menuItemDel = args.get_menuItem();
                    radconfirm('Are you sure you want to delete the folder: <b>' + treeNode.get_text() + '</b>', confirmCallBackFn, 300, 120, null, 'Folder Delete');
                }
                break;
     
        }
    }


    hit ENTER this starts the server side event ...NodeEdit.

    I need to execute server side ...ContextMenuItemClick after javascript treeNode.startEdit.
    Is this possible?
  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 21 Oct 2013 Link to this post

    Hello,

    Please find attached a sample project implementing very similar scenario:
    1. In the OnClientContextMenuItemClicking event handler the click event is canceled and the clicked item is stored.
    2. That way you can execute treeNode.startEdit and let user change the node text value.
    3. When he is finished typing the new node text value you can execute the click event for the stored menu item.
    4. This will fire the ContextMenuItemClick server-side event.


    Regards,
    Boyan Dimitrov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Thomas
    Thomas avatar
    3 posts
    Member since:
    May 2014

    Posted 17 Jun 2014 in reply to Boyan Dimitrov Link to this post

    What about stopping the editing function. I dont want to edit the node on node click. I have a button for that.
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 17 Jun 2014 Link to this post

    Hello,

    I would suggest stopping the node editing functionality by setting the RadTreeView property AllowNodeEditing="false".


    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top