RadContextMenu changes Q1 to Q2

4 posts, 0 answers
  1. Dave
    Dave avatar
    7 posts
    Member since:
    Aug 2012

    Posted 26 Aug 2008 Link to this post

    Hello, we have a RadContextMenu that we included javascript to hide on mouseout, but noticed from the trial in Q1 to our new Q2, that its outputing 2 divs now for the menu?  Do we add the events to the inner Div now?

    m_oWebMenu.Attributes.Add("onmouseout", "hideRadMenu(event, '"+ m_oWebMenu.ClientID +"')");

    old output:
    <div id="Header1_ctl00" class="RadMenu RadMenu_AMS rmContextMenu RadMenu_AMS_Context " onmouseout="hideRadMenu(event, 'Header1_ctl00')" onmouseover="window.status='';return true;" style="font-family:Verdana;font-size:8pt;">
      <!-- 2008.1.515.35 --><ul class="rmActive rmVertical rmGroup rmLevel1">
       <li class="rmItem rmFirst"><a href="#" class="rmLink " onclick="window.open('http://spiderbuild2.amsworld.com/robo/default.asp?project=V15352&amp;context=140')"><span class="rmText">Context...</span></a></li></ul><input id="Header1_ctl00_ClientState" name="Header1_ctl00_ClientState" type="hidden" />
     </div>

    new output:
    <div id="Header1_ctl00" onmouseout="hideRadMenu(event, 'Header1_ctl00')" onmouseover="window.status='';return true;">
      <!-- 2008.2.826.35 --><div class="RadMenu RadMenu_AMS rmContextMenu RadMenu_AMS_Context">
       <ul class="rmActive rmVertical rmGroup rmLevel1">
        <li class="rmItem rmFirst"><a href="#" originalAttribute="href" originalPath="#" class="rmLink " onclick="window.open('http://spiderbuild2.amsworld.com/robo/default.asp?project=V15352&amp;context=140')"><span class="rmText">Context...</span></a></li></ul>
      </div><input id="Header1_ctl00_ClientState" name="Header1_ctl00_ClientState" type="hidden" />
     </div>
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 27 Aug 2008 Link to this post

    Hi Dave,

    Indeed, we changed the rendering of the context menu to solve a problem with Ajax calls. To my regret we missed the possibility that a customer would use the attributes collection of the context menu to attach an event and currently the control doesn't work with the code you sent us.

    This can be done easily by using the client-side API of RadContextMenu though. Please, find attached a sample page, demonstrating this approach. Please note, that the get_contextMenuElement() method is available in the RadControls for ASP.NET Ajax Q2 2008 SP1 package, released Aug 26th, 2008 (version 2008.2.826).

    Let me know if that helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Dave
    Dave avatar
    7 posts
    Member since:
    Aug 2012

    Posted 27 Aug 2008 Link to this post

    That seems to work, but having problem with the javascript function I got from one of the support articles to hide a RadContextMenu.

    // function to hide any RadContextMenu  
    function hideRadMenu(e, m)  
    {  
        var destinationElement = e.toElement || e.relatedTarget;  
        var contextMenu = $find(m);  
        var menuDiv = $get(m);  
     
        while (destinationElement && destinationElement != menuDiv)  
        {  
             destinationElement = destinationElement.parentNode;  
        }  
        if (destinationElement == menuDiv)  
        {  
             //mouse is within the menu         
             return;  
        }        
     
        //mouse is out of the menu  
        contextMenu.hide();      
          
        $telerik.cancelRawEvent(e);  
    }  
     

    Also, before posting this question, I also tried the RadContextMenu.OnClientMouseOver and OnClientMouseOut events, but didn't seem to help.
  4. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 28 Aug 2008 Link to this post

    Hi Dave,

    All you need to do is add a call to the hideRadMenu(e, clientID) in the mouseOutHandler function, e.g.

        function mouseOutHandler(e, clientID)
        {
            hideRadMenu(e, clientID);
        }

    I hope this helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top