This is a migrated thread and some comments may be shown as answers.

RadContextMenu changes Q1 to Q2

3 Answers 66 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 26 Aug 2008, 11:35 PM
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>

3 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 27 Aug 2008, 07:53 AM
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.
0
Dave
Top achievements
Rank 1
answered on 27 Aug 2008, 06:25 PM

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.
0
Erjan Gavalji
Telerik team
answered on 28 Aug 2008, 08:46 AM
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.
Tags
Menu
Asked by
Dave
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Dave
Top achievements
Rank 1
Share this question
or