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

Conditional Formatting

RadTreeList provides the option to conditionally modify the appearance ofa given elements. For example, it might be convenient to change the background of the cells that contain negative values.

The following example shows how to handle the ItemDataBound event in order to apply a custom color/decoration to RadTreeList cell/row.

C#
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
	if (e.Item is TreeListDataItem)
	{
		TreeListDataItem item = e.Item as TreeListDataItem;
		int locationId = (int)DataBinder.Eval(item.DataItem, "LocationID");
		if (locationId < 8)
		{
			item.Font.Italic = true; //Row formatting            
			item["LocationName"].Font.Bold = true; //Cell formatting        
		}
	}
}			

RadTreeList Conditional Formatting

You can examine our online demo below:

RadTreeList Conditional formatting demo

Not finding the help you need?
Contact Support