A couple of "problems" to solve

Hi.
My name is Riccardo Esercitato and I am experimenting with DIAGRAM control and VB and ASP.NET.

I have a couple of problems, probably related to my inexperience.

1) I put three buttons in my page, one for a text node, one for an image node and one for a shpae node.
     When I click on a button it creates the correct node. But when I click another button it clears the diagram and draw the new node.
     I tried a "trick", saving diagram.nodes in a session variable, wich I restore at postback time, and it runs.
     But is there a better way to make diagram persits its content after a postback?

2) I have downloaded your sample diagrambuildervbsample-2003273269 but I am not able to run it because it gives me an error. 
     Anyway I think that this instruction: DiagramContent.OnClientDrop = "nodeondrop" means that there must be a sub/function somewhere, called      nodeondrop, wich will process that event. But I cannot find such name in your source code. I tried this in my program, but nothing happens.
     So, how can I intercept nodes movement?

3) I need to put a background image on diagram. I tried this: 

          Diagram1.BackColor = Color.Transparent
          Dim bckg As New Syncfusion.JavaScript.DataVisualization.Models.Diagram.BackgroundImage
          bckg.Source = "images\1abotticino-corr.jpg"
          Diagram1.Model.BackgroundImage = bckg

     without success. 
     Is there a way to load a background image or should I create an Image node and dimension it like the diagram control and use it as a fake     background?

Thanks a lot for any help

Riccardo ESERCITATO





1 Reply

KR Karkuvel Rajan Shanmugavel Syncfusion Team October 22, 2018 12:47 PM UTC

Hi Riccardo 
 
1.If we use postback session diagram only gets rerendered with its programmatically created behavior. We are not getting any manually changes in the postback session. So if you want to add Node at runtime, you can add through diagram.add() method. For this please refer to the below link. 
 
 
2.Sorry for the inconvenience caused in last update we only add event in the server side we forget to define in the client side. If you want to perform some actions during node drop means you can use the itemDropEvent in the diagram. 
 
3. By default the page background is set as white, the background image is set behind the page background so the image does not display. By set page background  color as transparent means the image is shown in the diagram. 
 
Please refer to the below code example: 
 
 
Diagram1.Model.PageSettings.PageWidth = 300; 
Diagram1.Model.PageSettings.PageHeight = 300; 
Diagram1.Model.PageSettings.PageBackgroundColor = "transparent"; 
Diagram1.Model.BackgroundImage.Source = "..//..//custom_images/nature.png"; 
 
Regards, 
Karkuvel Rajan S 


Loader.
Up arrow icon