Context menu for empty tree view (RadTreeView)?

2 posts, 0 answers
  1. Roland Klug
    Roland Klug avatar
    27 posts
    Member since:
    Dec 2002

    Posted 28 Jun 2010 Link to this post


    is it possible to add a context menu on an empty tree view, i.e. a tree view without any nodes?

  2. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 01 Jul 2010 Link to this post

    Hi Roland Klug,

    Well, you can create it declarative in the markup of the tree, and then add nodes on the client.
    Here is a brief example that I prepared for your case:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server">
        <script type="text/javascript">
            function onLoad(sender) {
                var tree=sender;
                var node=new Telerik.Web.UI.RadTreeNode();
        <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientLoad="onLoad">
                <telerik:RadTreeViewContextMenu ID="menu">
                        <telerik:RadMenuItem Text="Item1" />
                        <telerik:RadMenuItem Text="Item2" />
                        <telerik:RadMenuItem Text="Item3" />
                        <telerik:RadMenuItem Text="Item4" />

    Hope this is going to help you!

    Nikolay Tsenkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top