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>
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
}
}
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>
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
}
}
PopUp edit mode
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>
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
}
}
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 .