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.

Diagram ASP.NET modify node label at runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

78749 Dec 29,2008 06:54 AM Dec 30,2008 12:28 AM ASP.NET Web Forms (Classic) 3
loading
Tags: DiagramWebControl
Ricardo Gaona
Asked On December 29, 2008 06:54 AM

How can I change programmatically the node label at runtime in Diagram ASP.Net?


Ajeet M [Syncfusion]
Replied On December 29, 2008 07:07 AM

Hi Ricardo,

To change the Label of the node programmatically, please follow the steps below:

********
1. Assume you have a button to change the Label
2. In the click event you can type the code given below:
------
someNode.Labels[0].Text = "Some_Text_Here";
------

Where, "someNode" is the Node for which you need to change the Label.
********

Let me know if you shall need any further clarifications here.

Happy Coding!

- Ajeet



Ricardo Gaona
Replied On December 29, 2008 07:54 AM

I've tried the following:

1. C#:

protected void DiagramWebControl1_CallbackRefresh(object sender, Syncfusion.Web.UI.WebControls.Shared.CallbackEventArgs e)
{
Node node = DiagramWebControl1.Model.Nodes[e.CallbackArgument];
node.Labels[0].Text = "Some_Text";
}

and gives me an error: Error 23 'Syncfusion.Windows.Forms.Diagram.Node' does not contain a definition for 'Labels'

2. Javascript:

function EditText( ClickedNode )
{
node.Labels[0].Text = "Some_Text";
_sfDiagramWebControl1.Refresh(node.Name);
);

and nothing happens





Ajeet M [Syncfusion]
Replied On December 30, 2008 12:28 AM

Hi Ricardo,

To get the desired functionality, please follow the steps below:

1. In the aspx source, type in the JavaScript for the OnClientNodeClick event as follows:

function NodeClick(node)
{
_sfDiagramWebControl1.Refresh(node.Node.Name);
}

2. Now, in the CS page, under the DiagramWebControl's CallBackRefresh() event handler method, type as follows:

void DiagramWebControl1_CallbackRefresh(object sender, Syncfusion.Web.UI.WebControls.Shared.CallbackEventArgs e)
{
Node node = DiagramWebControl1.Model.Nodes[e.CallbackArgument];
if (node != null)
{
ell = node as Ellipse;
ell.Labels[0].Text = "XYZ";
}
}

I am sure this will resolve your query. Let me know if you shall need any clarifications in this regard.

Happy Coding!
- Ajeet



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.

;