We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Contextmenu on an image

Thread ID:





118567 Mar 19,2015 08:59 AM UTC Mar 20,2015 11:49 AM UTC ASP.NET Web Forms 1
Tags: Menu
Øyvind Knappskog Olsen
Asked On March 19, 2015 08:59 AM UTC


I'm wondering how to add a leftclick contextmenu on an asp image element?

Øyvind Knappskog Olsen
Norconsult Informasjonssystemer AS

Ezhil S [Syncfusion]
Replied On March 20, 2015 11:49 AM UTC

Hi Øyvind,

Thank you for contacting Syncfusion support.

Currently we haven’t provided in built property to enable context menu on left click. So that we suggest you to bind the click event for the image element and in the click event display the context menu. Using the show() method pass the X and Y coordinate of the mouse pointer along with the corresponding target element to display the ContextMenu on left click. Please refer the following code snippet,



<img src="Content/snowfall.jpg" width="300" height="300" runat="server" id="menutarget" />

<ej:Menu ID="Menu1" MenuType="ContextMenu" runat="server" ContextMenuTarget="#menutarget">


<ej:MenuItem Text="Cut"></ej:MenuItem>



<ej:MenuItem Text="Copy"></ej:MenuItem>



<ej:MenuItem Text="Paste"></ej:MenuItem>



<ej:MenuItem SpriteCssClass="separator"></ej:MenuItem>



<ej:MenuItem Text="Comments"></ej:MenuItem>



<ej:MenuItem Text="Links"></ej:MenuItem>



<ej:MenuItem Text="Clear Formatting"></ej:MenuItem>




<script type="text/javascript">

$("#<%=menutarget.ClientID%>").click(function () {

var menuobj = $("ul#<%=Menu1.ClientID%>").data("ejMenu");

menuobj.show(event.clientX, event.clientY, "#<%=menutarget.ClientID%>", "click"); // code to display the menu on left click




Please let us know if you have any other queries.


Ezhil S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon