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.
Syncfusion Feedback

Diagram click

Thread ID:

Created:

Updated:

Platform:

Replies:

106469 Jan 9,2013 08:11 AM UTC Jan 18,2013 07:26 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: DiagramWebControl
Kamel Gazzah
Asked On January 9, 2013 08:11 AM UTC

Hello
I have a diagram displayed in a web form
I want to let the user click on a particular item in the diagram (a round rectangle for example) and then the program should detect this item properties (Label for example)  to do a further treatment
How can I do that ?


Amsath Ali M [Syncfusion]
Replied On January 18, 2013 07:26 AM UTC

Hi kamel,

 

Thanks for your interest in Syncfusion products.

 

We suggest you to use either the DiagramWebControl’s  client side ‘OnClientNodeClick or the server side OnNodeClick” events to get the clicked node. Please refer the below code snippet to achieve your requirement.

 

Here is the code:

[Default.aspx]

 

<script type="text/javascript">

        function NodeClick(oData) {

            var Labels = oData.Node.Labels;

            for (var i = 0; i < Labels.length; i++) {

                if (Labels[i].Text != "")

                { alert("Clicked Node label's Text:"+" " +Labels[i].Text); }

            }

        }

    </script>

 

[Default.aspx.cs]

 

protected void Page_Load(object sender, EventArgs e)

        {

            if (!IsPostBack)

            {

 

                DiagramWebControl1.ClientObjectId = "_sfDiagramWebControl";

 

                Rectangle nodeA = new Rectangle(100, 100, 100, 70);

                nodeA.Name = "NodeA";

                nodeA.Labels.Add(new Syncfusion.Windows.Forms.Diagram.Label(nodeA, "Rectangle"));

                DiagramWebControl1.Model.AppendChild(nodeA);

 

                Ellipse nodeB = new Ellipse(300, 100, 100, 70);

                nodeB.Name = "NodeB";

                nodeB.Labels.Add(new Syncfusion.Windows.Forms.Diagram.Label(nodeB, "Ellipse"));

                DiagramWebControl1.Model.AppendChild(nodeB);

            }

        }

 

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M

 



103352_4488fbbb.zip

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.

Warning Icon 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.Close Icon

;