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

RadContextMenu displayed after clicking decorated button collapses inmediately

4 Answers 58 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 08 Jun 2009, 09:46 AM
Hello,

I've got a group of buttons into a div, which is defined as a decorated zone.
When one of the buttons is pressed a context menu is displayed, but this menu collapses inmediately. I have tried the same removing the div from the DecorationZoneID property, and then it works (the context menu keeps expanded).

Here is my code:

<script type="text/javascript">
function showMenu(e) {
          var contextMenu = $find("<%= RadContextMenu1.ClientID %>");
                 
          contextMenu.showAt(e.screenX, e.screenY);          
        }
</script>

<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecorationZoneID="Buttons"
                              DecoratedControls="All" />
<div id="Buttons" >
      <input id="Button1" type="button" onclick="showMenu(event)" value="Sections" />
                    <telerik:RadContextMenu ID="RadContextMenu1" runat="server" CollapseDelay="50000">
                      <Items> 
...
                      </Items>
                    </telerik:RadContextMenu>
    </div>


Any help? Thank you.

4 Answers, 1 is accepted

Sort by
0
Luis
Top achievements
Rank 1
answered on 08 Jun 2009, 11:52 AM
Could it be related with formdecorator focus problem?

It is possible that contextmenu, due to formdecorator, cannot get focus and so it hides.
0
Luis
Top achievements
Rank 1
answered on 10 Jun 2009, 09:12 AM
Please, Could anyone from Telerik tell me something about this problem?

Thanks in advance.
0
Accepted
Svetlina Anati
Telerik team
answered on 11 Jun 2009, 10:34 AM
Hi Luis,

I already answered your other thread and for your convenience and for others who might encounter the same problem, I pasted it below:

In general, you should cancel the event in order to prevent it to bubble to the document and this is done by calling $telerik.cancelRawEvent(event) as highlighted below:

http://www.telerik.com/help/aspnet-ajax/menu_clientsideradmenuradcontextmenu.html

In the case when the button is decorated by the RadFormDecorator, you should do this with a little timeout as shown below:

function showMenu(e) {  
      
      
          var contextMenu = $find("<%= RadContextMenu1.ClientID %>");   
            
          var x = e.screenX;  
          var y = e.screenY;  
          setTimeout(function()  
          {            
            contextMenu.showAt(x, y);   
          }, 100);  
                      
          $telerik.cancelRawEvent(e);        
            
        }  
        </script>  
 



Sincerely yours,
Svetlina
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.
0
Luis
Top achievements
Rank 1
answered on 15 Jun 2009, 08:50 AM
Thank you very much.

I tried before what you tell me in this post, both Cancel and timeout, but I definitely did something wrong bacause after copying your code everything works fine.
Tags
FormDecorator
Asked by
Luis
Top achievements
Rank 1
Answers by
Luis
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or