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.
Unfortunately, activation email could not send to your email. Please try again.

Custom context menu problem with CustomContextMenuItems class

Thread ID:

Created:

Updated:

Platform:

Replies:

130627 May 22,2017 08:41 PM May 23,2017 06:15 AM ASP.NET MVC 1
loading
Tags: Grid
Jonathan Dorval
Asked On May 22, 2017 08:41 PM

Hello. I'm trying to follow the doc to make a custom context menu on a asp.net MVC Grid control.

However, it seems like I can't resolve the class CustomContextMenuItems

    .ContextMenuSettings(contextMenu =>
    {
        contextMenu.EnableContextMenu()
            .CustomContextMenuItems(new List<CustomContexMenuItems>() { new CustomContexMenuItems() { Id = "MyMenu", Text = "MyMenuItem" } }); // CustomContext menu items

    })

I get the error
 CS0246: The type or namespace name 'CustomContexMenuItems' could not be found (are you missing a using directive or an assembly reference?)

Mani Sankar Durai [Syncfusion]
Replied On May 23, 2017 06:15 AM

Hi Jonathan, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and based on requirement we have prepared a sample that can be downloaded from the below link. 
Refer the code example. 
@(Html.EJ().Grid<MvcApplication14.OrdersView>("FlatGrid") 
                .Datasource((IEnumerable<object>)ViewBag.data) 
                  .AllowPaging() 
                
                       .ContextMenuSettings(contextMenu => 
                { 
                    contextMenu.EnableContextMenu(); 
                    contextMenu.CustomContextMenuItems(new List<Syncfusion.JavaScript.Models.CustomContexMenuItems>() { 
                    new Syncfusion.JavaScript.Models.CustomContexMenuItems() { Id = "MyMenu", Text = "MyMenuItem" } , 
 
                    }); 
                }) 
        .Columns(col => 
        { 
... 
        }) 
         
) 
 
 

If you are mentioning the class name alone we suggest you refer the corresponding namespace in Razor page. 
Refer the code example. 
@using Syncfusion.JavaScript.Models; 
@(Html.EJ().Grid<MvcApplication14.OrdersView>("FlatGrid") 
                ... 
                       .ContextMenuSettings(contextMenu => 
                { 
                    contextMenu.EnableContextMenu(); 
                    contextMenu.CustomContextMenuItems(new List<CustomContexMenuItems>() { 
                    new CustomContexMenuItems() { Id = "MyMenu", Text = "MyMenuItem" } , 
 
                    }); 
                }) 
        .Columns(col => 
        { 
        }) 
         
) 

The issue is due to DLL Conflict. To avoid this issue, please make sure the following things before build your application. 
1.       Check if multiple versions of Syncfusion assemblies are referred in your project. 
2.       Delete bin and obj folders exists in the application directory. 
3.       Check your dll version in reference and web.config file 
4.       Check if you are referring proper dependent assemblies according to the .NET Framework.  
 
Refer the documentation link: 
 
 
Regards, 
Manisankar Durai. 
 
  
 
 
 


CONFIRMATION

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.

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.

;