A newer version of this page is available. Switch to the current version.


  • 4 minutes to read

The ASPxTreeView control supports template technology, allowing you to completely customize the control’s appearance and layout. The look of the ASPxTreeView control’s default elements can be completely modified by creating a specific template, defining how an element will be rendered by a client browser.

TreeView - Templates

The ASPxTreeView control allows you to create templates for two element types: the node text content and the entire node content. You can apply templates for all identical elements within the ASPxTreeView (using control level templates) or for a particular element (using node level templates).

The table below lists the members, used to create templates:

Entire node content templates Node text content templates
Control level templates ASPxTreeView.NodeTemplate ASPxTreeView.NodeTextTemplate
Node level templates TreeViewNode.Template TreeViewNode.TextTemplate

Note that templates created at the node level override control level templates.


You can respond to manipulations with elements contained within a template, by writing a ASPxTreeView.NodeCommand event handler, to perform specific actions each time the event is raised by any control contained within any template.


Template Creation

At design time, you can create a template, using Template Designer, or directly in the .aspx file. The image below shows how the Template Designer can be invoked.

TreeView - Template Designer

Example: Creating Templates in ASPX Markup

This example demonstrates how different templates can be defined in aspx code. The result is shown by the first image in this topic (see it above).

This example demonstrates how you can create templates.


A complete sample project is available at https://github.com/DevExpress-Examples/how-to-create-templates-e2511

protected void Page_Load(object sender, EventArgs e)

Member Table