Skip to main content

ASPxTreeList.DeleteNode(String) Method

Deletes the specified node.

Namespace: DevExpress.Web.ASPxTreeList

Assembly: DevExpress.Web.ASPxTreeList.v24.2.dll

NuGet Package: DevExpress.Web

#Declaration

public void DeleteNode(
    string nodeKey
)

#Parameters

Name Type Description
nodeKey String

A string value that identifies the node.

#Remarks

Once the DeleteNode method is called, the ASPxTreeList.NodeDeleting event is raised. It allows you to cancel the delete operation. After a node has been deleted, the ASPxTreeList.NodeDeleted event is raised.

End-users can delete nodes using the Delete button.

To learn more, see Adding and Deleting Nodes.

#Example

This example shows how to delete selected nodes.

The image below shows the result:

exDeleteSelectedNodes

To learn more, see Adding and Deleting Nodes.

using DevExpress.Web.ASPxTreeList;

protected void Page_Load(object sender, EventArgs e) {
    ASPxTreeList1.SettingsEditing.AllowRecursiveDelete = true;
}
protected void ASPxTreeList1_CustomCallback(object sender,
TreeListCustomCallbackEventArgs e) {
    foreach (TreeListNode node in ASPxTreeList1.GetSelectedNodes())
        ASPxTreeList1.DeleteNode(node.Key);
    ASPxTreeList1.DataBind();
}
See Also