- Home
- Forum
- ASP.NET Core - EJ 2
- Show context Menu on click
Show context Menu on click
Hi,
I am trying to adapt the issue : https://www.syncfusion.com/forums/153298/show-context-menu-on-click, (which is in Angular) in Asp.Net Core. But I can't.
I have exactly the same need with custom context menu.
Can you provide me the code example?
Thanks,
Laurent
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
MS
Manivel Sellamuthu
Syncfusion Team
January 20, 2021 11:46 AM UTC
Hi Laurent,
Greetings from Syncfusion support.
We have shared a code example based on your requirement. Please refer the below code example and sample for more information.
|
@{
List<object> commands = new List<object>();
commands.Add(new { buttonOption = new { iconCss = "e-icons e-conmenu", cssClass = "e-flat" } });
}
<div>
<ejs-grid id="Grid" commandClick="commandClick" dataSource="ViewBag.DataSource" allowSorting="true" allowExcelExport="true"
allowPdfExport="true"
contextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending",
"SortDescending","Copy", "Edit", "Delete", "Save", "Cancel","PdfExport", "ExcelExport", "CsvExport",
"FirstPage", "PrevPage","LastPage", "NextPage"})" allowPaging="true">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-columns>
. . .
<e-grid-column headerText="Commands" width="150" commands="commands"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
function commandClick(args) {
if (args.target.querySelector('.e-conmenu')) {
this.contextMenuModule.contextMenu.openMenu(null, null, event.pageY, event.pageX, event);
}
}
</script>
<style>
.e-grid .e-conmenu::before {
content: '\e984';
}
</style> |
Please let us know, if you need further assistance.
Regards,
Manivel
Marked as answer
LA
Laurent
January 21, 2021 07:21 AM UTC
Thanks a lot. It works perfectly fine.
Best regards,
MS
Manivel Sellamuthu
Syncfusion Team
January 22, 2021 05:35 AM UTC
Hi Laurent,
Thanks for your update.
We are glad to hear that the provided solution helped resolve your query.
Please let us know, if you need further assistance.
Regards,
Manivel
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
LA Laurent
- Jan 19, 2021 09:21 PM UTC
- Jan 22, 2021 05:35 AM UTC