how to know which subitem belong to which main menu item when user is clicked on on a command bar DropDownButton

2 posts, 0 answers
  1. vinson
    vinson avatar
    3 posts
    Member since:
    Feb 2017

    Posted 10 Mar 2017 Link to this post


    I am using a drop down button on the command bar. The number of main menu items are unknown in advance, it depends on the number of year of records are stored in the local database. On each main menu item, there are fixed amount of submenu items representing 12 months of a year as shown in the attached image.

    My question is how can I know a user has pressed the submenu item from its corresponding parent? Let's say user pressed the submenu item 'January' from the the main menu item '2017', hence, I can show each record stored in the database related to January 2017 not January 2016 or January  2018 and vice versa.

    I have these line of codes in my application which me to detech which month a user has click a subitem. I just can't figuer out how to detech the click is from which parten..

    menuItem[j].Items[m].Click += WonderingRecordsForm_MouseDown;

    RadMenuItem clickedMenuItem = (RadMenuItem) sender;

  2. Hristo
    Hristo avatar
    1510 posts

    Posted 14 Mar 2017 Link to this post

    Hello Vinson,

    Thank you for writing.

    Each RadMenuItem exposes a HierarchyParent property which you can access and check which the actual parent is. For example, you can handle the Click event of an item and check for its parent:
    private void radMenuItem_Click(object sender, EventArgs e)
        RadMenuItem item = (RadMenuItem)sender;
        var parent = item.HierarchyParent;
        if (parent != null)
    I hope this helps. Should you have further questions please do not hesitate to write back.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top