This is a migrated thread and some comments may be shown as answers.

Rename on double click

1 Answer 18 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Senthil
Top achievements
Rank 1
Senthil asked on 20 Aug 2013, 06:53 AM
Hi

How can I rename a node on double clicking it?

Senthil

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 20 Aug 2013, 07:19 AM
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.
Tags
TreeView
Asked by
Senthil
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or