This demo shows the two possible approaches you can use when defining the RadTreeList control structure dynamically:
- Create the RadTreeList entirely in code-behind on Page_Init.
- Add the RadTreeList declaration statically in the page mark-up and configure it on Page_Load.
When RadTreeList is created on Page_Init, you should first set the columns' properties and after that add them to the RadTreeList Columns collection.
On the other hand, when the RadTreeList is declared statically and configured on Page_Load, you should first add the columns to the RadTreeList Columns collection and after that set their properties. Also check the condition (Not IsPostBack) to avoid adding the same structure objects to the treelist twice.