New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Edit Mode Overview

RadTreeList supports the below edit modes:

The default edit mode of RadTreeList is EditForms. To specify which edit mode will your control, you can set its EditMode property to one of the above values.

InPlace edit mode

To display the treelist in-place edit form, you need to set the EditMode property of your RadTreeList control to InPlace. When an item goes in edit mode, the edit form will be displayed instead of the regular treelist item.

<telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList1" runat="server" EditMode="InPlace" 
    DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo" DataSourceID="SqlDataSource1">            
</telerik:RadTreeList>

RadTreeList InPlace EditMode

Note that in-place edit mode is supported only for auto-generated edit forms.

When InPlace editing is applied, in the ItemCreated/ItemDataBound you can access the edit/insert form as below:

protected void RadTreeList1_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListDataItem)
    {
        //item is in regular mode
    }
    if (e.Item is TreeListEditableItem && (e.Item as TreeListEditableItem).IsInEditMode)
    {
        //item is in edit mode
    }
    if (e.Item is TreeListDataInsertItem)
    {
        //item is in insert mode
    }
}
Protected Sub RadTreeList1_ItemCreated(ByVal sender As Object, ByVal e As TreeListItemCreatedEventArgs)
    If TypeOf e.Item Is TreeListDataItem Then
        'item is in regular mode
    End If
    If TypeOf e.Item Is TreeListEditableItem AndAlso CType(e.Item, TreeListEditableItem).IsInEditMode Then
        'item is in edit mode
    End If
    If TypeOf e.Item Is TreeListDataInsertItem Then
        'item is in insert mode
    End If
End Sub

EditForms edit mode

To display the treelist in-forms edit form, you need to set the EditMode property of your RadTreeList control to EditForms. When an item goes in edit mode, the edit form will be displaed just below the edited item.

<telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList2" runat="server" EditMode="EditForms" 
    DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo" DataSourceID="SqlDataSource1">            
</telerik:RadTreeList>

RadTreeList EditForms Edit Mode

When the RadTreeList edit mode is EditForms, you can access the edited item and the edit/insert form on ItemCreated/ItemDataBound as below:

protected void RadTreeList2_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListDataItem)
    {
        //item is in regular mode
    }
    if (e.Item is TreeListEditFormItem)
    {
        //item is in edit mode
    }
    if (e.Item is TreeListEditFormInsertItem)
    {
        //item is in insert mode
    }
}
Protected Sub RadTreeList2_ItemCreated(ByVal sender As Object, ByVal e As TreeListItemCreatedEventArgs)
    If TypeOf e.Item Is TreeListDataItem Then
        'item is in regular mode
    End If
    If TypeOf e.Item Is TreeListEditFormItem Then
        'item is in edit mode
    End If
    If TypeOf e.Item Is TreeListEditFormInsertItem Then
        'item is in insert mode
    End If
End Sub

To display the treelist pop-up edit form, you need to set the EditMode property of your RadTreeList control to PopUp. When an item goes into edit mode, the edit form will be displayed in front of the treelist and the edited item style will change respectively.

<telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList3" runat="server" EditMode="PopUp" 
    DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo" DataSourceID="SqlDataSource1">            
</telerik:RadTreeList>

RadTreeList PopUp Edit Mode

When the RadTreeList edit mode is PopUp, you can access the edited item and the edit/insert form on ItemCreated/ItemDataBound as below:

protected void RadTreeList3_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListDataItem)
    {
        //item is in regular mode
    }
    if (e.Item is TreeListEditFormItem)
    {
        //item is in edit mode
    }
    if (e.Item is TreeListEditFormInsertItem)
    {
        //item is in insert mode
    }
}
Protected Sub RadTreeList3_ItemCreated(ByVal sender As Object, ByVal e As TreeListItemCreatedEventArgs)
    If TypeOf e.Item Is TreeListDataItem Then
        'item is in regular mode
    End If
    If TypeOf e.Item Is TreeListEditFormItem Then
        'item is in edit mode
    End If
    If TypeOf e.Item Is TreeListEditFormInsertItem Then
        'item is in insert mode
    End If
End Sub

If you want to hide the the duplicate caption text that shows in the popup edit form, you can set the EditFormSettings.PopUpSettings.ShowCaptionInEditForm property of the treelist control to false .

See Also

In this article