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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply fillcolor to connector label

Thread ID:





118991 May 1,2015 05:26 PM UTC May 5,2015 12:52 PM UTC ASP.NET Web Forms 3
Tags: Diagram
Jim Jacobs
Asked On May 1, 2015 05:26 PM UTC


I thought this would be easy.

I'm trying the following:

diagram.updateLabel(conn.name, conn.labels[0], { fillColor: 'white' });

It would seem that conn.labels[0] is undefined.

What am I doing wrong?



Shyam G [Syncfusion]
Replied On May 4, 2015 01:12 PM UTC

Hi Jim

Thanks for using Syncfusion products.

We are glad to let you know that we have created a simple sample to achieve your requirement and it is available in the below link for download. Please refer the code snippet:

Code snippet:

<ej:diagram id="Diagram1" runat="server" height="1000px" width="1000px">

//creating connectors

Connector connect = new Connector();

connect.Name = "samsa";

//adding labels

Label label = new Label();

label.Text = "ram";

<input type="button" value="updatelabel" onclick="updatelabel()" />

<script type="text/javascript">

function updatelabel() {

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

var connector = diagram.model.selectedItems.children[0];

if (connector)

diagram.updateLabel(connector.name,connector.labels[0], {fillColor:"blue"});



Please let me know if any concerns.

Shyam G

Jim Jacobs
Replied On May 4, 2015 01:50 PM UTC

Hi Shyam,

Thanks for the code.
Actually I ended up changing the fillcolor in the OnClientTextChange event handler.
It seems that the label does not exist until you first double-click on the connector to add the text.
Anyway, this approach works for me.

Thanks for confirming that my updateLabel statement was in the correct format.


Shyam G [Syncfusion]
Replied On May 5, 2015 12:52 PM UTC

Hi Jim

Thanks for your update.

It seems that the label does not exist until you first double-click on the connector to add the text.
Please note that by default there won’t be label added in the elements. Once the editing is completed, if an element has a label then the label will updated or else it will be added to the element. Please note that updateLabel method is applicable only when the element has a label.

Please let me know if any concerns,

Shyam G


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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