Recreate menu on click

3 posts, 1 answers
  1. Eduardo
    Eduardo avatar
    30 posts
    Member since:
    Feb 2009

    Posted 03 Jun 2009 Link to this post


    I have a problem here. I don't know if my approach is the best, but I'm using a menu as breadcrumbs because I need  each breadcrumb to have a menu. I am implementing the easy way and recreating in javascript all the items and menus of the breadbrumbs. In my case there is no performance issues as at most there will be only 4 layers and not many menu items on each layer.

    However, I'm now facing a problem. When someone clicks one of the items in the breadcrumbs menu, I clear all items in the menu and recreate it to reflect the new navigation content. Everything seems to work fine, until I get a javascript error on the Telerik code when I try to hover the new menu item. It happens when it tries to run some code to update the zIndex of the control, however the control items are not there anymore, my routine already removed and recreated with other items.

    Is there a way to accomplish that? Recreating the whole menu is much easier than checking where it was clicked and only update the items needed :)

    Here it is a testing code I am using (the real code is much, much bigger):

    <html xmlns="" > 
    <head runat="server"
        <telerik:radcodeblock ID="RadCodeBlock1" runat="server"
            <script type="text/javascript"
                function onClicking(sender, eventArgs) { 
                    var BreadCrumbs = $find("<%= RadMenu1.ClientID %>"); 
                    var item = eventArgs.get_item(); 
                    var name = item.get_text(); 
                    var childItem = new Telerik.Web.UI.RadMenuItem(); 
                    for (var i = 0; i < 3; i++) { 
                        var menuItem = new Telerik.Web.UI.RadMenuItem(); 
                        menuItem.set_text("Test " + i); 
        <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
            <telerik:RadMenu ID="RadMenu1" runat="server" 
                    <telerik:RadMenuItem runat="server" Text="Root"
                            <telerik:RadMenuItem runat="server" Text="Test 1"
                            <telerik:RadMenuItem runat="server" Text="Test 2"
                            <telerik:RadMenuItem runat="server" Text="Test 3"

  2. Answer
    T. Tsonev
    T. Tsonev avatar
    2791 posts

    Posted 08 Jun 2009 Link to this post

    Hello Eduardo,

    Thank you for reporting this problem. The menu keeps a reference to the currently open item and calls close() for it when it's no longer part of the menu. We've fixed this bug and the fix will be available in the internal build tomorrow (version 2009.1.608 and up). A temporary solution is to call close() before calling clear():

    // ...
    // ...

    I hope this helps. As a token of our gratitude for your involvement, your Telerik points have been updated.

    All the best,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Eduardo
    Eduardo avatar
    30 posts
    Member since:
    Feb 2009

    Posted 08 Jun 2009 Link to this post

    Hi Tsvetomir Tsonev,

    Thanks very much, I already added the .close to the menu before clearing the items and it seems it is working fine. I just don't say for sure because my actual application grew much larger than the example i sent you :). But by trying to navigate everywhere, I didn't get any of that error anymore.

    Thanks once again,
Back to Top