New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Determine Last Level of TreeList

Environment

ProductRadTreeList for ASP.NET AJAX

Description

In some scenarios with TreeList you might want to execute custom logic only for the innermost level - e.g. hiding or disabling some buttons or applying conditional color.

Solution

You can achieve this requirement using the following method:

C#
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
    if (e.Item is TreeListDataItem)
    {
        TreeListDataItem item = e.Item as TreeListDataItem;

        if (!item.CanExpand)
        {
            // execute custom logic
        }
    }
}
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support