How to load diagram when page is shown

Hi,
I have the diagram on a page and is storing and loading the content of the diagram using my own code.
The nodes and connections are simply added to the 2 collections, nodes and connections.

It works just fine, if I store and load using buttons on the page

Now I would like to load when a user open the blazor page that holds the diagram.
However how can I do that? 
In several of the page start events the diagram control is not defined and if I load in the OnAfterRenderAsync event I get the attached error.

So is there a way so I can add nodes and connections using C# code when a page is opened?


Attachment: Exception_b34d6b23.zip

3 Replies 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team June 10, 2021 12:37 PM UTC

Hi Torben, 
 
On the further analysis of the shared details, we suspect the reason for the reported issue is you have tried to load the diagram before the diagram rendered. We suggest you use the created event to load the diagram to avoid the reported issue, the created event will trigger after the diagram rendered. Please refer to the following sample for how to load a saved JSON diagram at the created event.  
 
 
If we misunderstood your requirement, please share us more details or replicate the issue in the shared sample. This will be helpful for us to proceed further. 
 
Regards,  
Gowtham 


Marked as answer

TL Torben Laursen June 11, 2021 11:46 AM UTC

Thanks, that solved the problem :)


GG Gowtham Gunashekar Syncfusion Team June 14, 2021 11:27 AM UTC

Hi Torben, 
 
Thanks for your update. Please let us know whether you need any further assistance on this. 
 
Regards  
Gowtham 


Loader.
Up arrow icon