ASP.NET 3.5 and above only

ASP.NET TreeView - Editing Node Text


  • Editing is disabled for the nodes, 'Libraries' and 'Music'.

  • Libraries
    • Documents
      • My Documents
      • Public Documents
    • Music
      • My Music
      • Public Music
    • Pictures
      • My Pictures
      • Public Pictures
    • Videos
      • My Videos
      • Public Videos


[ASPX]

<obout:Tree ID="VistaTree" AllowNodeEdit="true" OnBeforeNodeEdit="OnClientBeforeNodeEdit"    
    OnNodeEdit="OnClientNodeEdit" CssClass="vista" runat="server">
    <Nodes>
        <obout:Node Text="Libraries" AllowEdit="false" ...>
            <obout:Node Text="Documents" ...>...</obout:Node>
            <obout:Node Text="Music" AllowEdit="false" ...>...</obout:Node>
            ...
        </obout:Node>
    </Nodes>
</obout:Tree>
            
[Javascript]

function OnClientBeforeNodeEdit(sender, args) {
    var chk_conform = document.getElementById("<%=chk_cfm.ClientID %>");
    if (chk_conform.checked) {
        var action = confirm("Are you sure to rename '" + args.text + "'?");
        args.cancel = !action;
    }
}
function OnClientNodeEdit(sender, args) {
    var chk_conform = document.getElementById("<%=chk_cfm.ClientID %>");
    if (chk_conform.checked && args.text != args.newText) {
        var action = confirm("Rename '" + args.text + "' to '" + args.newText + "'?");
        args.cancel = !action;
    }
}
            

"I have been looking at your Flyout control and I am very impressed! I have been looking for a similar control for quite some time."

Steve Pietrek

Random testimonial   All testimonials