This is a migrated thread and some comments may be shown as answers.

Context menu for empty tree view (RadTreeView)?

1 Answer 90 Views
This is a migrated thread and some comments may be shown as answers.
Roland Klug
Top achievements
Rank 1
Roland Klug asked on 28 Jun 2010, 02:26 PM

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


1 Answer, 1 is accepted

Sort by
Nikolay Tsenkov
Telerik team
answered on 01 Jul 2010, 02:52 PM
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
Asked by
Roland Klug
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question