Rename on double click

2 posts, 0 answers
  1. Senthil
    Senthil avatar
    7 posts
    Member since:
    Aug 2013

    Posted 20 Aug 2013 Link to this post

    Hi

    How can I rename a node on double clicking it?

    Senthil
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Aug 2013 Link to this post

    Hi Senthil,

    Please try the following code snippet that I have tried.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientDoubleClick="OnClientDoubleClick"
        OnNodeEdit="RadTreeView1_NodeEdit">
        <Nodes>
            <telerik:RadTreeNode runat="server" Text="Item1">
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Subitem1">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Subitem2">
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
        </Nodes>
    </telerik:RadTreeView>

    JavaScript:
    <script type="text/javascript">
        function OnClientDoubleClick(sender, args) {
            var node = args.get_node();
            node.startEdit();
        }
    </script>

    C#:
    protected void RadTreeView1_NodeEdit(object sender, Telerik.Web.UI.RadTreeNodeEditEventArgs e)
        {
            e.Node.Text = e.Text;
        }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top