Different context menu for items.

3 posts, 1 answers
  1. Henry
    Henry avatar
    44 posts
    Member since:
    Feb 2013

    Posted 09 Jul 2013 Link to this post

    Hello 

    I need a clarification. Can I have different context menu for different root items in a radtreeview?

    Thankyou
    HG.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2013 Link to this post

    Hi Henry,

    You can have different context menus for different root items. Please have a look at the following mark-up.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientContextMenuShowing="onClientContextMenuShowing">
        <ContextMenus>
            <telerik:RadTreeViewContextMenu ID="MainContextMenu" runat="server">
                <Items>
                    <telerik:RadMenuItem Value="Copy" Text="Copy ..." ImageUrl="~/TreeView/Img/Outlook/10.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="Rename" Text="Rename ..." Enabled="false" ImageUrl="~/TreeView/Img/Outlook/rename.gif"
                        PostBack="false">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="NewFolder" Text="New Folder" ImageUrl="~/TreeView/Img/Outlook/12.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="Delete" Text="Delete Folder" ImageUrl="~/TreeView/Img/Outlook/7.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem IsSeparator="true">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="MarkAsRead" Text="Mark All as Read">
                    </telerik:RadMenuItem>
                </Items>
                <CollapseAnimation Type="none"></CollapseAnimation>
            </telerik:RadTreeViewContextMenu>
            <telerik:RadTreeViewContextMenu ID="EmptyFolderContextMenu" runat="server">
                <Items>
                    <telerik:RadMenuItem Value="NewFolder" Text="New Folder" ImageUrl="~/TreeView/Img/Outlook/12.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem IsSeparator="true">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="EmptyFolder" Text="Empty this folder" ImageUrl="~/TreeView/Img/Outlook/2DeletedItems.gif">
                    </telerik:RadMenuItem>
                </Items>
                <CollapseAnimation Type="none"></CollapseAnimation>
            </telerik:RadTreeViewContextMenu>
        </ContextMenus>
        <Nodes>
            <telerik:RadTreeNode Value="_Private_PersonalFolders" ImageUrl="~/TreeView/Img/Outlook/1PersonalFolders.gif"
                ContextMenuID="MainContextMenu" AllowEdit="false" Text="Personal Folders" Expanded="true">
                <Nodes>
                    <telerik:RadTreeNode Value="_Private_PublicFolders" ImageUrl="~/TreeView/Img/Outlook/folder.gif"
                        AllowEdit="false" Text="Public folders (2)" Font-Bold="true">
                        <Nodes>
                            <telerik:RadTreeNode Text="Favorites" ImageUrl="~/TreeView/Img/Outlook/folder.gif">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode Text="All Public Folders (2)" ImageUrl="~/TreeView/Img/Outlook/folder.gif"
                                Font-Bold="true">
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
            <telerik:RadTreeNode Value="_Private_PersonalFolders" ImageUrl="~/TreeView/Img/Outlook/1PersonalFolders.gif"
                ContextMenuID="EmptyFolderContextMenu" AllowEdit="false" Text="Private Folders"
                Expanded="true">
            </telerik:RadTreeNode>
        </Nodes>
    </telerik:RadTreeView>

    Thanks,
    Shinu.
  3. Henry
    Henry avatar
    44 posts
    Member since:
    Feb 2013

    Posted 09 Jul 2013 Link to this post

    Thankyou shinu :)
Back to Top