Back to Devexpress

TreeListSettingsEditing.AllowRecursiveDelete Property

aspnet-devexpress-dot-web-dot-aspxtreelist-dot-treelistsettingsediting-ec7b219f.md

latest3.9 KB
Original Source

TreeListSettingsEditing.AllowRecursiveDelete Property

Gets or sets whether parent nodes can be deleted.

Namespace : DevExpress.Web.ASPxTreeList

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

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(false)]
public bool AllowRecursiveDelete { get; set; }
vb
<DefaultValue(False)>
Public Property AllowRecursiveDelete As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true to allow deleting parent nodes within their children; false only child nodes (not parent) can be deleted.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AllowRecursiveDelete
ASPxTreeList

.SettingsEditing .AllowRecursiveDelete

|

Remarks

If the AllowRecursiveDelete option is disabled, an error message is displayed when deleting a parent node. To change the error text, use the TreeListSettingsText.RecursiveDeleteError property.

To learn more, see Adding and Deleting Nodes.

Example

This example shows how to delete selected nodes.

The image below shows the result:

To learn more, see Adding and Deleting Nodes.

csharp
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();
}
vb
Imports DevExpress.Web.ASPxTreeList

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    ASPxTreeList1.SettingsEditing.AllowRecursiveDelete = True
End Sub

Protected Sub ASPxTreeList1_CustomCallback(ByVal sender As Object, _
ByVal e As TreeListCustomCallbackEventArgs)
    For Each node As TreeListNode In ASPxTreeList1.GetSelectedNodes()
        ASPxTreeList1.DeleteNode(node.Key)
    Next node
    ASPxTreeList1.DataBind()
End Sub
aspx
<dxe:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False"
    CssFilePath="~/App_Themes/Glass/{0}/styles.css"
    CssPostfix="Glass" OnClick="ASPxButton1_Click" Text="Delete Selected"
    EnableClientSideAPI="True">
    <ClientSideEvents Click="function(s, e) {
        treeList.PerformCallback('');
    }" />
</dxe:ASPxButton>

See Also

RecursiveDeleteError

ConfirmDelete

Tree List

TreeListSettingsEditing Class

TreeListSettingsEditing Members

DevExpress.Web.ASPxTreeList Namespace