StartNodeInEditNode in ascx(?)

2 posts, 0 answers
  1. Michel
    Michel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 05 Dec 2011 Link to this post


    I can't edit a node after it is created (or copy).
    My Treeview is in an ascx file...

    For exemple :
    protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        RadTreeNode clickedNode = e.Node;
         switch (e.MenuItem.Value)
            case "Copy":
                RadTreeNode clonedNode = clickedNode.Clone();
                clonedNode.Text = string.Format("Copy of {0}", clickedNode.Text);
                //set node's value so we can find it in startNodeInEditMode
                clonedNode.Value = clonedNode.GetFullPath("/");
                clonedNode.Selected = true;

    and :
    private void startNodeInEditMode(string nodeValue)
                //find the node by its Value and edit it when page loads
                string js = "Sys.Application.add_load(editNode); function editNode(){ ";
                js += "var tree = $find(\"" + RadTreeView1.ClientID + "\"); ";
                js += "var node = tree.findNodeByValue('" + nodeValue + "');";
                js += "if (node) node.startEdit();";
                js += "Sys.Application.remove_load(editNode);};";
                RadScriptManager.RegisterClientScriptBlock(this, this.GetType(), "nodeEdit", js, true);

    (in debug nodeValue = "ADVANTECH/Automation Controllers")

    I don't know what to try to edit the new node :-(
    Enclosed : just after copy a node
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 06 Dec 2011 Link to this post

    Hello Michel,

    In you startNodeInEditMode js that your generating is using the findNodeByValue method , while you are passing to the method the text of the Node. You should be passing in the value, if that's what you're using to locate the node.

    I hope that helps.
Back to Top