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;
    }
}
            

"Thank you very much for your support. It is actually quite nice to receive lightning fast responses especially when one is on the other side of the world."

Clinton Morrison

Random testimonial   All testimonials