Search code examples
c#asp.nettelerikradtreelist

Set all RadTreeList items to edit mode


I have been working with Telerik RadGrids and I haven't had any problem setting all items to edit mode when I'm populating the grid.

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridEditableItem)
    {
        e.Item.Edit = true;
    }
}

Now I'm working with a Telerik RadTreeList and I would like to do something similar. Is it any possible way to do this? As far as I have been searching, I haven't found any possible solution for this.


Solution

  • The solution goes as follows:

    protected void RadTreeList1_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            foreach (TreeListDataItem item in RadTreeList1.Items)
            {
                if (item is TreeListDataItem)
                {
                    item.Edit = true;
                }
            }
            RadTreeList1.Rebind();
        }
    }
    

    The (!IsPostBack) condition would depend on if the TreeListDataItem get's populated at Page_Load.