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

"These controls are working great for us. And our customer loves them. We are creating new programs all the time. So having great support to us is very important. Thanks for your help."

Jeremy Zimmerman
BAE Systems

Random testimonial   All testimonials