how to show all items of RadMenu expanded

4 posts, 0 answers
  1. Ujwala
    Ujwala avatar
    15 posts
    Member since:
    Apr 2014

    Posted 07 Oct 2014 Link to this post

    Hi all, i am using Radmenu control in a project. so we have an urgent requirement from client that all the radmenu items are shows expanded. we need to show root element and its child elements and sub child elements are all expanded. so how we can achieve this functionality? Please help me its urgent task to do?
  2. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 07 Oct 2014 Link to this post

    Hello,

    In order to expand all RadMenuItems with children, you can try the following code:
    <telerik:RadMenu ID="RadMenu1" runat="server" OnClientLoad="OnClientLoad" ClickToOpen="true" OnClientItemClosing="ItemClosing">
        <Items>
            ...
        </Items>
    </telerik:RadMenu>
    <script type="text/javascript">
        var $ = $telerik.$;
     
        function OnClientLoad(sender) {
            menu1 = sender;
     
            for (var i = 0; i < sender.get_allItems().length; i++) {
                if (sender.get_allItems()[i].get_items().get_count() > 0) {
                    sender.get_allItems()[i].open();
                }
            }
        }
     
        function ItemClosing(menu, args) {
            args.set_cancel(true);
        }
    </script>

    Hope this will be helpful.

    Regards,
    Aneliya Petkova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ujwala
    Ujwala avatar
    15 posts
    Member since:
    Apr 2014

    Posted 08 Oct 2014 Link to this post

    Thanks Aneliya, i have tried this code but no success. only the last element of radmenu gets expanded and visible and we are showed this only on devices.Please suggest me any other solution/ help
  5. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 08 Oct 2014 Link to this post

    Hello,

    Could you please elaborate a little more on your exact scenario since I'm not quite sure I understand it exactly. From your first post, I understood that you need to expand all items of the RadMenu. If this is not the case, please explain in details which item you need to expand and on which event exactly. Also in your last post, you mention that you need this functionality to works on some devices. It would be helpful if you provide information where you need this to work(pc, tablets or smartphones and the browsers).
    Also it would be very helpful if you send me your RadMenu markup.

    I will be waiting to your reply.

    Regards,
    Aneliya Petkova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top