Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

Did you check at http://www.telerik.com/help/aspnet-ajax/treelist-server-side-basics.html?

RadTreeList has an ItemCreated event as well.

Can you try?

protected void RadTreeList1_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListDataItem)
    {
        TreeListDataItem item = e.Item as TreeListDataItem;
        item.Edit = true;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top