Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Collapse]Site Navigation and Layout
   [Expand]Product Information
   [Expand]Form Layout
   [Expand]Menu
   [Expand]Navigation Bar
   [Expand]Page Control and Tab Control
    Panel Overview
   [Expand]Ribbon
   [Expand]Site Map Control
   [Expand]Splitter
   [Expand]Tag Cloud Control
   [Expand]Title Index
   [Collapse]TreeView
     ASPxTreeView Overview
    [Collapse]Concepts
      Node
     [Expand]Binding to Data
      Expanding and Collapsing Nodes
      Animation Effect
      Selection
      NodeLinkMode
      Check Box Support
      Callbacks
      Templates
    [Expand]Visual Elements
    [Expand]Examples
    [Expand]Member Tables
    [Expand]ASPxTreeView - Animated Images
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Templates

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.

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.

 

Expanded 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.

Expanded 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).

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2511.

This example demonstrates how you can create templates.

Expanded Member Table

How would you rate this topic?​​​​​​​