Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

TreeView / Custom Attributes

  • Marketing
    • Carina Joplin
    • Tom Wolfe
  • Sales
    • Dashiel Robins
    • Carla Gillotti
    • Jane Adams
  • R & D
    • Giorgio Aressi
    • Lydia Kraus
  • Development
    • George Malinovsky
    • Mashona Washington
  • Design
    • Iren Patello
    • Nick Angel
    • Mike Zivin
Details: Carina Joplin
Position: Marketing Director
Mobile: 555-888-201
Email: carina.joplin@example.com
Room: 201

  • Select a node to see the details for that person.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.TreeView.CustomAttributes.DefaultVB"
        Language="vb" %>

    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <qsf:HeadTag runat="server" ID="Headtag1"></qsf:HeadTag>
        <style type="text/css">
        
         .RadTreeView img.rtImg {
                margin: 2px 0 2px 3px;
            }
            
        </style>
    </head>
    <body class="BODY">
        <form runat="server" id="mainForm" method="post">
            <qsf:Header runat="server" ID="Header1" NavigationLanguage="VB"></qsf:Header>
            <telerik:RadScriptManager runat="Server" ID="RadScriptManager1" />
            <div style="width: 200px; float: left">

                <script type="text/javascript">
                    function onNodeClicked(sender, args)
                    {
                        showDetails(args.get_node());
                    }

                    function showDetails(node)
                    {
                        if (node.get_attributes().getAttribute("Position"))
                        {
                            var position = node.get_attributes().getAttribute("Position");
                            var name = node.get_text();
                            var email = node.get_attributes().getAttribute("Email");
                            var phone = node.get_attributes().getAttribute("Phone");
                            var room = node.get_attributes().getAttribute("Room");
                            $get("details").style.display = "block";
                            $get("<%= position.ClientID %>").innerHTML = position;
                            $get("<%= name.ClientID %>").innerHTML = name;
                            $get("<%= email.ClientID %>").innerHTML = email;
                            $get("<%= phone.ClientID %>").innerHTML = phone;
                            $get("<%= room.ClientID %>").innerHTML = room;
                        }
                        else
                        {
                            $get("details").style.display = "none";
                        }
                    }
                </script>

                <telerik:RadTreeView ID="RadTreeView1" runat="Server" OnClientNodeClicked="onNodeClicked">
                    <Nodes>
                        <telerik:RadTreeNode Text="Marketing" Expanded="True">
                            <Nodes>
                                <telerik:RadTreeNode Text="Carina Joplin" Position="Marketing Director" Phone="555-888-201"
                                    Room="201" Email="carina.joplin@example.com" Image="2.gif" ImageUrl="Img/female1.gif"
                                    Selected="true" />
                                <telerik:RadTreeNode Text="Tom Wolfe" Position="Marketing Executive" Phone="555-888-202"
                                    Room="202" Email="tom.wolfe@example.com" ImageUrl="Img/male1.gif" />
                            </Nodes>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Sales" Expanded="True">
                            <Nodes>
                                <telerik:RadTreeNode Text="Dashiel Robins" Position="Sales Director" Phone="555-888-301"
                                    Room="301" Email="dashiel.robins@example.com" ImageUrl="Img/male2.gif" />
                                <telerik:RadTreeNode Text="Carla Gillotti" Position="Sales Rep" Phone="555-888-302"
                                    Room="302" Email="carla.gillotti@example.com" ImageUrl="Img/female2.gif" />
                                <telerik:RadTreeNode Text="Jane Adams" Position="Sales Rep" Phone="555-888-303" Room="303"
                                    Email="jane.adams@example.com" ImageUrl="Img/female3.gif" />
                            </Nodes>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="R &amp;amp; D" Expanded="True">
                            <Nodes>
                                <telerik:RadTreeNode Text="Giorgio Aressi" Position="R &amp;D Director" Phone="555-888-401"
                                    Room="401" Email="giorgio.aressi@example.com" ImageUrl="Img/male3.gif" />
                                <telerik:RadTreeNode Text="Lydia Kraus" Position="R &amp;D Manager" Phone="555-888-402"
                                    Room="402" Email="lydia.kraus@example.com" ImageUrl="Img/female4.gif" />
                            </Nodes>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Development" Expanded="True">
                            <Nodes>
                                <telerik:RadTreeNode Text="George Malinovsky" Position="Chief of Development" Phone="555-888-501"
                                    Room="501" Email="george.malinovsky@example.com" ImageUrl="Img/male4.gif" />
                                <telerik:RadTreeNode Text="Mashona Washington" Position="Senior Developer" Phone="555-888-502"
                                    Room="502" Email="mashona.washington@example.com" ImageUrl="Img/female5.gif" />
                            </Nodes>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Design" Expanded="True">
                            <Nodes>
                                <telerik:RadTreeNode Text="Iren Patello" Position="Creative Director" Phone="555-888-601"
                                    Room="601" Email="irene.patello@example.com" ImageUrl="Img/male5.gif" />
                                <telerik:RadTreeNode Text="Nick Angel" Position="Senior Print Designer" Phone="555-888-602"
                                    Room="602" Email="nick.angel@example.com" ImageUrl="Img/male6.gif" />
                                <telerik:RadTreeNode Text="Mike Zivin" Position="Senior Web Designer" Phone="555-888-603"
                                    Room="603" Email="nick.angel@example.com" ImageUrl="Img/male7.gif" />
                            </Nodes>
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeView>
            </div>
            <div style="float: right; width: 310px; background: url(Img/bg.jpg) no-repeat; height: 200px;
                padding: 30px 0 0 30px; margin-top: 40px; margin-left: 70px;">
                <div style="color: #4888a3; font-size: 23px; padding-bottom: 10px;">
                    Details:
                    <asp:Label runat="Server" ID="name" />
                </div>
                <div id="details" style="font-size: 12px; line-height: 21px;">
                    Position:
                    <asp:Label runat="server" ID="position" />
                    <br />
                    Mobile:
                    <asp:Label runat="server" ID="phone" />
                    <br />
                    Email:
                    <asp:Label ID="email" runat="server" />
                    <br />
                    Room:
                    <asp:Label runat="server" ID="room" />
                </div>
            </div>
            <qsf:Footer runat="server" ID="Footer1"></qsf:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451