- Home
- Forum
- ASP.NET MVC
- Add custom context menu to grid control
Add custom context menu to grid control
Hi,
I am trying to add a custom context menu to a Grid control as follows:
@(Html.EJ().Grid<Object>("FlatGrid")
.AllowPaging()
.ContextMenuSettings(contextMenu =>
{
contextMenu.EnableContextMenu().CustomContextMenuItems(new List<string>() { "MyMenuItem" });
})
.ClientSideEvents(eve => { eve.ContextClick("contextclick").RightClick("rightclick").ContextOpen("contextopen"); })
.Columns(col =>
{
col.Field("BookingCode").HeaderText("Booking Code").Add();
col.Field("BookingDate").HeaderText("BookingDate").Format("{0:dd/MM/yyyy}").Add();
col.Field("CustomerReference").HeaderText("Customer Reference").Add();
col.Field("Note").HeaderText("Note").Add();
col.Field("StatusCode").HeaderText("Status").Add();
col.Field("TypeCode").HeaderText("Type").Add();
}))
but get the following compilation error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: CS1660: Cannot convert lambda expression to type 'Syncfusion.JavaScript.Models.ContextSettings' because it is not a delegate type
Source Error:
|
Any help to resolve this issue would be much appreciated.
SIGN IN To post a reply.
1 Reply
PK
Prasanna Kumar Viswanathan
Syncfusion Team
August 23, 2016 11:24 AM UTC
Hi Mahindra,
Thanks for contacting Syncfusion support.
We have modified the customContextMenuItems property to accept the values as the list of objects instead of list of strings. We also informed about this changes in Release notes of 14.1.0.41. Please refer to code example, sample and release notes for more information
Code example:
|
@(Html.EJ().Grid<OrdersView>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.ContextMenuSettings(contextMenu =>
{
contextMenu.EnableContextMenu()
.CustomContextMenuItems(new List<CustomContexMenuItems>() { new CustomContexMenuItems() { Id = "MyMenu", Text = "MyMenuItem" } }); // CustomContext menu items
})
.AllowPaging()
.ClientSideEvents(eve => { eve.ContextClick("contextclick"); })
.Columns(col =>
{
-----------------------------------
})
) |
Sample: http://www.syncfusion.com/downloads/support/forum/125511/ze/SyncfusionMvcApplication14-321676807
Regards,
Prasanna Kumar N.S.V
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
MM Mahindra Morar
- Aug 22, 2016 06:24 AM UTC
- Aug 23, 2016 11:24 AM UTC