TreeView - Custom Node Style

  •   Most Visited
  •   Latest Post
  •   Most Replies
  • Community Forums
    • Desktop Technologies
      • 2007 Microsoft Office System
      • Microsoft Office 2003
      • Microsoft Office XP
    • Web Technologies
      • ASP.NET
        • General ASP.NET
        • ASP.NET AJAX
        • Advanced ASP.NET
        • Source Projects
      • Silverlight
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB
With RadTreeView you can customize the look and feel of each single TreeNode.

The TreeNodes expose the following properties that can be used to apply certain CSS classes to the nodes:


Each of the above properties determines the CSS class to be applied to the TreeNode when it is in the respective mode (normal, disabled, hovered and selected).

This example shows how to use the CssClass properties of the nodes to make them look unique.
  • DefaultCS.aspx
  • styles.css
<%@ Page AutoEventWireup="true" Language="c#"  Inherits="Telerik.QuickStart.QsfPage" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-narrow">
        <div class="bigModule">
            <div class="bigModuleBottom">
                <ul style="margin-top: 0; list-style: none">
                    <li style="float: left; margin-right: 30px;"><span style="width: 20px; margin-right: 5px; background: #93b45c; display: block; border: solid 1px #5c5c5c; float: left">&nbsp;</span>
                        Most Visited
                    <li style="float: left; margin-right: 30px;"><span style="width: 20px; margin-right: 5px; background: #c25a51; display: block; border: solid 1px #5c5c5c; float: left">&nbsp;</span>
                        Latest Post
                        <span style="width: 20px; background: #4f84bf; display: block; margin-right: 5px; border: solid 1px #5c5c5c; float: left">&nbsp;</span> Most Replies
        <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView1" >
                <telerik:RadTreeNode Text="Community Forums" Expanded="true">
                        <telerik:RadTreeNode Text="Desktop Technologies" Expanded="true">
                                <telerik:RadTreeNode Text="2007 Microsoft Office System" CssClass="latestPost">
                                <telerik:RadTreeNode Text="Microsoft Office 2003" CssClass="mostVisited">
                                <telerik:RadTreeNode Text="Microsoft Office XP" CssClass="mostReplies">
                        <telerik:RadTreeNode Text="Web Technologies" Expanded="true">
                                <telerik:RadTreeNode Text="ASP.NET" Expanded="true">
                                        <telerik:RadTreeNode Text="General ASP.NET" CssClass="mostVisited">
                                        <telerik:RadTreeNode Text="ASP.NET AJAX" CssClass="latesPost">
                                        <telerik:RadTreeNode Text="Advanced ASP.NET" CssClass="mostReplies">
                                        <telerik:RadTreeNode Text="Source Projects">
                                <telerik:RadTreeNode Text="Silverlight" CssClass="latestPost">

Find Assistance

Help Us Improve

Was this example helpful?