I am trying to make my RadContextMenu stay open when use the left click. It works find when i use the right mouse click because that is the default, but i also want to open the context menu on right click, it closes straight away as soon as it is opened.
Layout
<telerik:RadButton ID="btnGenerate" runat="server"
Text="Generate..." ToolTip="Click to generate the tracking/tags/preview for the current creative"
OnClientClicked="generateMenuItemOnLeftClick">
</telerik:RadButton>
<telerik:RadContextMenu ID="cmGenerate" runat="server" Flow="Horizontal"
OnItemClick="cmGenerate_ItemClick" OnClientItemClicking="generateMenuItemClicking">
<Items>
<telerik:RadMenuItem runat="server" Text="Generate Tracking" Value="generateTracking" />
<telerik:RadMenuItem runat="server" Text="Generate Preview" Value="generatePreview" />
<telerik:RadMenuItem runat="server" Text="Generate Tags" Value="generateTags" />
</Items>
<Targets>
<telerik:ContextMenuControlTarget ControlID="btnGenerate" />
</Targets>
</telerik:RadContextMenu>
JS
function generateMenuItemOnLeftClick(sender, eventArgs) {
var currentLocation = $telerik.getLocation(sender.get_element());
var contextMenu = $find("<%=cmGenerate.ClientID%>");
contextMenu.showAt(currentLocation.x, currentLocation.y + 22);
}
This is for other people who have the same issue. I found that you have to call
$telerik.cancelRawEvent(event);
right after a showAt(..) method. This cancels the default behavior which is the instant close.