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

[Solved] Context Menu prevents standard menu to show

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Loy Chan
Top achievements
Rank 1
Loy Chan asked on 08 Feb 2010, 03:11 AM
I've implemented a context menu in my RadGrid but I only want it to display when the user clicks on the row portion of the grid. If the row is in edit mode, I still want the standard context menu to show up when the user right clicks on a text box so that they use the standard cut and paste.

I followed the example for the AJAX-enabled context menu but whenever the evt.target.tagName == "INPUT", the event stops dead. I would have thought that the right click event would have bubbled up and thus the standard context menu for the text box would show up.

What am I missing?
 
           function RowContextMenu(sender, eventArgs) 
           { 
               var menu = $find("<%=RadMenu1.ClientID %>"); 
               var evt = eventArgs.get_domEvent(); 
                
               if(evt.target.tagName == "INPUT" || evt.target.tagName == "A") 
               { 
                 return; 
               } 
                

Thanks

Loy.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Feb 2010, 06:43 AM
Hi Loy,

The onRowContextMenu function is only raised when the user right-clicks on a row. The handler will not be raised when you are clicking on an editformitem, or any of the input elements within it. One possible option in this case would be to assign onmousedown/onclick client side event handlers for the whole edit form, or for some of the controls contained in it.
The click event occurs for the left mouse button only. Therefore, onClick event handlers do not need to preform the left-versus-right button test.
On the other hand, the mousedown and mouseup events may occur for any mouse button. To determine whether the user clicked the left or right button, you can use the following event properties:

event.which in Netscape Navigator
event.button in Internet Explorer

If the value of these properties is 1, the event occurred for the left button.

Additionally, more information on how to access a cell/controls within the edit form, you can find in the following topic:

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

I hope this information helps.

All the best,
Yavor
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Grid
Asked by
Loy Chan
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or