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

Dynamically adding nodes to tree view


Hi,
i am a new user of syncfusion essentil tools
How can i dynamically add nodes to a tree view.
i want to impliment like this. when i right click a particular node .a menu like add new node appears.then a windows explorer prompt appears and we enter the new node name.then we add some database operations with ajax.i have implimented so far. but i want to update the treeview with the new node while maintaing the treenodes current state.how can i impliment it without postback? (I have seen a forum post(MessageID=48369) implimenting this feature with callbackpanel.but i could not download that exe. it is corrupted .)i have tried some functions like this __doPostBack('TreeView1','expand|indexid')._sfTreeView1.callback('TreeView1','expand|indexid').But i could not reach a solution.

When i create a treenode with expandmode=serversidecallback,and i click the plus '+ 'sign (expand),it definitely calls a ajax call with certain arguments.if possible,i need that function



i have seen that this forum is very active.i hope i will get a solution

2 Replies

VA Valli Syncfusion Team March 20, 2007 12:34 PM UTC

Hi Sujith,

I have created a sample as per your requirement and you can download it from the following link:

http://websamples.syncfusion.com/samples/Tools.Web/4.4.0.51/F58149/main.htm

The above sample helps you to dynamically add nodes to the TreeView control without triggering a server side post back event.

1. On right clicking a 'TreeViewNode' you get an Menu displayed by using the 'ClientSideOnContextMenu' property of the TreeView control.
2. The client side function defined on the menu item 'AddTreeViewNode' displays a 'Waiting Popup' when it is selected.
3. The 'Waiting Popup' prompts until you enter the 'Name' for the TreeView Node.
4. On entering the 'Name' for the TreeViewNode, Click 'AddNew' button which hides the Popup and refresh the TreeView control which is done by the below code snippet:
Tree.Refresh();
5. Tree.Refresh(): Triggers the server side callback function 'TreeView1_CallbackRefresh1' which adds the 'TreeView node' without causing a post back.

Please try running the sample and let me know if you have any further concerns.

Thanks for choosing Syncfusion products.

Regards,
Valli


SK sujith ks March 22, 2007 02:58 PM UTC

Thanks .it worked.

Loader.
Live Chat Icon For mobile
Up arrow icon