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.

How to use AddInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

117175 Aug 28,2014 01:11 AM May 21,2018 12:44 AM ASP.NET MVC 6
loading
Tags: Diagram
Jeff
Asked On August 28, 2014 01:11 AM

Hi, can you give me some guidance on how to use the AddInfo property of nodes?

  1. How to add items to AddInfo in MVC/.NET
  2. How to retrieve the values in JavaScript

Thanks for your help.


Jeff
Replied On August 28, 2014 01:11 AM

Ooops.  I meant to put this in the ASP.NET MVC forum.  Could you move it for me?  Sorry, and thank you.


Shyam G [Syncfusion]
Replied On August 28, 2014 01:34 AM

Hi Jeff

Thanks for using Syncfusion products.

 

Query

Response

Hi, can you give me some guidance on how to use the AddInfo property of nodes?

1.       How to add items to AddInfo in MVC/.NET

2.       How to retrieve the values in JavaScript

Thanks for your help.

We have created a simple sample to meet your requirement and attached below. Please see the code snippet below.

 

//add items to addinfo

          Node add = CreateNode("add", 150, 50, 200, 200, "add");

            Dictionary<string, object> addInfo = new Dictionary<string, object>();

            addInfo.Add("email", "gs@gmail.com");

            add.AddInfo = addInfo;

            model.Nodes.Add(add);

 

function onclick(args) {

           var diagram = $("#Diagram1").ejDiagram("instance");

           if (args.element.shape) {

              

//retreiving addinfo values in javascript

 

 var addinfo = args.element.addInfo.email;

           alert(addinfo);

        }

    }

 

Please let me know if any concerns.

Regards,

Shyam G


Attachment: addinfo_42671972.zip

Jeff
Replied On August 28, 2014 06:57 PM

Thanks for the sample.  That worked well.


Shyam G [Syncfusion]
Replied On August 31, 2014 11:50 PM

Hi Jeff,

Thanks for your reply.

We are happy to hear that the problem is resolved.

Regards,

Shyam G


Gyorgy Gorog
Replied On May 18, 2018 07:44 AM

Hi, at least in the present version js args.element.addinfo does not seem to exist. I tried .element.attributes.getNamedItem() but failed. Please advise.

Shyam G [Syncfusion]
Replied On May 21, 2018 12:44 AM

Hi Gyorgy Gorog, 
 
We have created a MVC sample in which we have set an addInfo property for nodes and retrieved it in the client side(.cshtml file) using click event. Please refer to the code example and sample below. 
 
Code example: 
 
DiagramController.cs 
 
  BasicShape node = new BasicShape(); 
   //create addInfo property for node 
   Dictionary<string, object> addInfo = new Dictionary<string, object>(); 
   addInfo.Add("email", "ram@gmail.com"); 
   node.AddInfo = addInfo; 
   Diagram.Nodes.Add(node); 
 
  //define click event 
  Diagram.Click = "click"; 
 
  function click(args) { 
        if (args.element) { 
            if (args.element.addInfo) { 
                             //retrieve addInfo property 
                alert(args.element.addInfo.email); 
            } 
        } 
    } 
 
 
Regards, 
Shyam G 


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.

;