Dose the Tree list have a Context Menu funcationality

2 posts, 0 answers
  1. Tejas Kan
    Tejas Kan avatar
    6 posts
    Member since:
    Oct 2009

    Posted 18 Nov 2010 Link to this post

    Hi ,
    I am not sure if the Tree list support a Context Menu function?
    If yes could you please provide me a link to an example.

    Thanks in advance

    Tejas
  2. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 22 Nov 2010 Link to this post

    Hi Tejas,

    Even though RadTreeList does not currently expose its own context menu, you can easily bind a RadContextMenu to RadTreeList. You can refer to a similar demo using RadListView and RadContextMenu. The approach is the same - you use the javascript oncontextmenu event of the tree list items to show a context menu. To attach an client oncontextmenu event handler to the tree list items, you can use the ItemCreated event of the control:

    protected void RadTreeList1_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
    {
        if (e.Item is TreeListDataItem)
        {
            TreeListDataItem dataItem = (TreeListDataItem)e.Item;
            dataItem.Attributes["oncontextmenu"] = "ShowContextMenu(" + dataItem.DisplayIndex + ");";
        }
    }

    Veli
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top