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. Image for the cookie policy date

Context Menu issue after loading from database

Hi ,

After setting the various context menu parameters on the server side, I am getting an error.

"Cannot read property 'test' of undefined"

Server side code for adding context menu items is :

                    DiagramProperties model = new DiagramProperties();
                    List<ContextMenuItem> LabelSubItems = new List<ContextMenuItem>();
                    LabelSubItems.Add(new ContextMenuItem() { Name = "alignLabel", Text = "Align Label" });
                    LabelSubItems.Add(new ContextMenuItem() { Name = "updateRowLabel", Text = "Row Label", });
                    model.ContextMenu = new DiagramContextMenu();
                    model.ContextMenu.Items.Add(new ContextMenuItem() { Name = "test", Text = "Label Test" });
                    model.ContextMenu.Items.Add(new ContextMenuItem() { Name = "label", Text = "Label Update", SubItems = LabelSubItems });

                    model.ContextMenuBeforeOpen = "contextMenuBeforeOpen";
                    model.ContextMenuClick = "contextMenuClick";

Could you please let me know what might be the issue?


3 Replies

SG Shyam G Syncfusion Team September 8, 2017 04:46 PM UTC

Hi Aravind, 
We have applied your code example in our sample and we are unable to reproduce the reported issue at our end. Could you please provide us more details such as modify the below sample or share your sample or video to demonstrate the exact use case of the issue. 
Shyam G 

AA Aravind Ashokkumar September 9, 2017 05:07 PM UTC

Hi Shyam,

I had corrected the issue after adding the following line to the c#html page. 




SG Shyam G Syncfusion Team September 11, 2017 04:16 AM UTC

Hi Aravind, 
We are happy to hear that your problem is resolved. Please let us know if you need further assistance on this. 
Shyam G 

Live Chat Icon For mobile
Up arrow icon