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. Image for the cookie policy date

Access to tree in razorpage code when using UrlAdaptor to get remote data?

When I try treeView.AddNodes,in the razor code, after fetching data successfully using the UrlAdaptor, I can't get the UI to update with new node. The code below just gets the root node independent of what the tree looks like:

List<object> treeData = await treeView.GetTreeData();


3 Replies

KM Kanagambigai Murugan Syncfusion Team July 24, 2019 12:19 PM UTC

Hi Mike, 

Greetings from Syncfusion. 

You can dynamically add the tree nodes via AddNodes method using the following code snippet. 

public void addNodes() 
{ 
     List<object> listdata = new List<object>(); 
     listdata.Add(new 
        { 
            employeeID = this.index, 
            firstName = "NewItem", 
        }); 
         this.tree.AddNodes(listdata); 
         this.index = this.index + 1; 
} 

 

Kindly ensure once whether you provided the same id and text field as same as the initial mapping.  

Output image 

 


Please check the above sample and get back to us if you need any further assistance. 

Regards, 
Kanagambigai 




MI MikeR replied to Kanagambigai Murugan July 24, 2019 09:35 PM UTC

Hi Mike, 

Greetings from Syncfusion. 

You can dynamically add the tree nodes via AddNodes method using the following code snippet. 

public void addNodes() 
{ 
     List<object> listdata = new List<object>(); 
     listdata.Add(new 
        { 
            employeeID = this.index, 
            firstName = "NewItem", 
        }); 
         this.tree.AddNodes(listdata); 
         this.index = this.index + 1; 
} 

 

Kindly ensure once whether you provided the same id and text field as same as the initial mapping.  

Output image 

 


Please check the above sample and get back to us if you need any further assistance. 

Regards, 
Kanagambigai 



Thanks this was what I needed.
/Miker


KM Kanagambigai Murugan Syncfusion Team July 25, 2019 04:53 AM UTC

Hi Mike, 

Thanks for the update. 

We are glad to hear that the provided solution has worked as expected. Please get back to us if you need any further assistance. We would be happy to assist you. 

Regards, 
Kanagambigai M. 


Loader.
Up arrow icon