Radmenu rendering Issue

3 posts, 0 answers
  1. Madhu
    Madhu avatar
    8 posts
    Member since:
    Jul 2010

    Posted 18 Mar 2013 Link to this post

    Hi,

    I have a dynamic menu fully through JavaScript which acts as a context menu and items keeps on changing based on the selection. The issue that I face is with rendering. First time when menu is invoked, it renders properly and all sub menus comes properly. However when same invoked second time, it seems each menu have different width and some of the images that lies underneath is visible through  menu. See the image & code attached.

     

     

     

     

    function resetMenu(menu) {

     

    menu.get_items().clear();

    }

     

     

    function addMenuItem(menu, caption, value) {

     

     

     

    var item = new Telerik.Web.UI.RadMenuItem();

     

    item.set_text(caption);

    item.set_value(value);

    item.set_visible(

     

    true);

     

    menu.get_items().add(item);

    }

     

     

    function buildMenu(key) {

     

     

     

    var menu = $find("<%= radActionMenu.ClientID %>");

     

     

     

    var id = key.substring(key.indexOf("-", 0) + 1, key.length);

     

    menu.trackChanges();

    resetMenu(menu);

     

     

    if (key.substring(0, 1) == "1") addMenuItem(menu, "View ", "1-" + id)

     

     

     

    if (key.substring(1, 2) == "1") addMenuItem(menu, "Issue ", "2-" + id)

     

     

     

    if (key.substring(2, 3) == "1") addMenuItem(menu, "Issue ", "3-" + id)

     

     

     

    if (key.substring(3, 4) == "1") addMenuItem(menu, "History", "4-" + id)

     

     

    if (key.substring(4, 5) == "1") addMenuItem(menu, "Add Add Add Add", "5-" + id)

     

     

     

     

    menu.commitChanges();

    }

     

     

     

    function showMenu(e, key) {

     

     

     

    var contextMenu = $find("<%= radActionMenu.ClientID %>");

     

    $telerik.cancelRawEvent(e);

     

     

    if ((!e.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget))) {

     

    buildMenu(key);

    contextMenu.show(e);

    }

    }

     

     

     

    <telerik:RadContextMenu ID="radActionMenu" runat="server" EnableRoundedCorners="True"

     

     

     

     

     

     

     

    EnableShadows="True" OnClientItemClicked="onClicked" CausesValidation="False"

     

     

     

     

     

     

     

    EnableViewState="False" ExpandDelay="50" >

     

     

     

     

     

     

     

    <Items>

     

     

     

     

     

     

     

     

    </Items>

     

     

     

     

     

     

     

    </telerik:RadContextMenu>

     

  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 18 Mar 2013 Link to this post

    Hi Madhu,

    Since this is a visual error, it is most likely attributed to a change in the css class. Did you change the styling of the RadMenu in the css file? This could cause the RadMenu to look a little off. If not then I'm not quite sure what could cause the box to turn transparent like that.

    Good luck,
    Master Chief
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Madhu
    Madhu avatar
    8 posts
    Member since:
    Jul 2010

    Posted 18 Mar 2013 Link to this post

    Master,
        I'm not doing any style changes. Only recreating items.

        Btw How to apply style to newly created menu items? I will try in that angle and if same issue persists will think about a work around.


    Regards
    Madhu
Back to Top