Treeview edit node issue in IE

2 posts, 0 answers
  1. Sandip Patil
    Sandip Patil avatar
    2 posts
    Member since:
    May 2010

    Posted 13 Apr 2012 Link to this post

    Hello,

    I am trying to add new sub node in treeview node from client-side and set that newly added node in edit mode, case is that the node is collapsed in which I want to add new node. For that I am 1st expand that collapsed node from client side and add new node in that expanded node from client side and set node in edit mode.

    The issue i am facing is that other than IE browser all is working correctly, but in IE as it goes in edit mode, it does not remains in edit mode and it automatically leaves the edit mode. (tried in IE8, IE9).

    Please can you guide me where I am going wrong?

    The client side code I am using is as follows:

    <asp:UpdatePanel ID="searchResultsUpdatePanel" runat="server" ChildrenAsTriggers="true"
                            RenderMode="Block" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div>
                                    <cc1:PRadTreeView ID="RadTreeView1" class="classCategoryTreeView" runat="server" OnNodeExpand="RadTreeView1_NodeExpand"
                        EnableDragAndDrop="True" OnNodeDrop="RadTreeView1_HandleDrop" EnableDragAndDropBetweenNodes="true"
                        OnNodeEdit="RadTreeView1_NodeEdit" CheckBoxes="True"
                        OnClientNodeEditStart="OnClientNodeEditStartHandler"
                        OnContextMenuItemClick="RadTreeView1_ContextMenuItemClick" OnClientContextMenuItemClicking="onClientContextMenuItemClicking"
                        OnClientContextMenuShowing="onClientContextMenuShowing" OnClientNodeClicked="ClientNodeClicked" OnClientNodeEditing="ClientNodeEditing">
                        <ContextMenus>
                            <cc1:PRadTreeViewContextMenu ID="MainContextMenu" runat="server">
                                <Items>
                                    <cc1:PRadMenuItem Value="New" Text="New">
                                    </cc1:PRadMenuItem>
                                    <cc1:PRadMenuItem Value="Rename" Text="Rename"
                                        Enabled="false" PostBack="false">
                                    </cc1:PRadMenuItem>
                                    <cc1:PRadMenuItem Value="Delete" Text="Delete">
                                    </cc1:PRadMenuItem>
                                </Items>
                                <CollapseAnimation Type="none" />
                            </cc1:PRadTreeViewContextMenu>
                        </ContextMenus>
                    </cc1:PRadTreeView>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:UpdateProgress ID="tagsUpdatePanelProgressControl" runat="server">
                            <ProgressTemplate>
                            </ProgressTemplate>
                        </asp:UpdateProgress>


    function onClientContextMenuItemClicking(sender, args) {
                try {
                    var menuItem = args.get_menuItem();
                    var treeNode = args.get_node();
                    menuItem.get_menu().hide();
                    var currTagID = treeNode.get_value();
                    switch (menuItem.get_value()) {
                        case "Rename":
                            break;
                        case "New":
                            args.set_cancel(true);
                            AddTempNode(false);
                            break;
                        case "Delete":
                             break;
                    }
                } catch (e) {
                    alert(e.ToString());
                }
            }

    function "AddTempNode" is called from onClientContextMenuItemClicking,

    function AddTempNode(addToRoot) {
                var projectID = document.getElementById('<%= hidProjectID.ClientID %>').value;
                var treeView = $find("<%= RadTreeView1.ClientID %>");
                var parentTagID = 0;
                var node = null;
                if (addToRoot) {
                    treeView.unselectAllNodes();
                }
                var nodes = treeView.get_selectedNodes();
                if (nodes.length == 0) {
                    parentTagID = 0;
                }
                else {
     
                    for (var i = 0; i < nodes.length; i++) {
                        node = nodes[i];
                    }
                    parentTagID = node.get_value();
                }
                treeView.trackChanges();
                if (node != null) {
                    node.expand();
                }
                treeView.commitChanges();
                var newTagID = 0;
                var newNode = CreateNewNode(projectID, newTagID, ' ', parentTagID);
                if (addToRoot) {
                    newNode.set_cssClass("categoryControl_Root_Node");
                }
                AddNewlyCreatedNode(newNode, treeView);
                newNode.startEdit();
                return false;
            }
     
     
     
    function AddNewlyCreatedNode(node, treeView) {
                treeView.trackChanges();
                var nodes = treeView.get_selectedNodes();
                if (nodes.length == 0) {
                    treeView.get_nodes().add(node);
                }
                else {
                    treeView.get_selectedNodes()[0].get_nodes().add(node);
                }
                treeView.commitChanges();
            }
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 18 Apr 2012 Link to this post

    Hi Sandip,

    Unfortunately I wasn't able to reproduce the problem. It might me connected with some of the functions that you have attached to the TreeView's events and haven't posted here. Could you try running the project with the TreeView declared like this, and see if the problem reproduces:
    <telerik:RadTreeView ID="RadTreeView1" class="classCategoryTreeView" runat="server"
        EnableDragAndDrop="True" EnableDragAndDropBetweenNodes="true"
        CheckBoxes="True"
        OnClientContextMenuItemClicking="onClientContextMenuItemClicking">

    Could you also specify the version of the controls that you use.
     
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top